Hi,
I am trying to place a table containing some text inside of a shape. I set the width and height of the shape and the row height/cell width to the same values. But the cell still extends pass the boundaries of the shape. I am trying to create a circle with a letter “A” in the center of the shape.
I am using Aspose.Words 9.0.0.0
Thanks.
Here is some sample code:
DocumentBuilder builder = new DocumentBuilder();
builder.StartTable();
Cell cell = builder.InsertCell();
builder.Font.ClearFormatting();
builder.ParagraphFormat.ClearFormatting();
builder.CellFormat.ClearFormatting();
cell.CellFormat.Width = 468;
cell.CellFormat.Shading.BackgroundPatternColor = Color.White;
cell.ParentRow.RowFormat.Height = ConvertUtil.PixelToPoint(520) * .78;
builder.EndRow();
GroupShape group2 = new GroupShape(builder.Document);
group2.Width = 468;
group2.Height = ConvertUtil.PixelToPoint(520) * .78;
group2.CoordOrigin = Point.Empty;
group2.AllowOverlap = false;
cell.FirstParagraph.AppendChild(group2);
Shape shape;
Paragraph p;
Run run;
shape = new Shape(builder.Document, ShapeType.Ellipse);
shape.TextBox.FitShapeToText = false;
shape.AllowOverlap = false;
shape.TextBox.InternalMarginBottom = 0;
shape.TextBox.InternalMarginLeft = 0;
shape.TextBox.InternalMarginRight = 0;
shape.TextBox.InternalMarginTop = 0;
// Determine the size of each part and then translate that to the 1000x1000 coordinate
// plane of the GroupShape object
shape.Left = 6.25;
shape.Top = 386;
shape.Width = 38.75;
shape.Height = 59.61;
shape.CoordOrigin = Point.Empty;
Table table = new Table(builder.Document);
Row row = new Row(builder.Document);
Cell cell2 = new Cell(builder.Document);
group2.AppendChild(shape);
cell2.CellFormat.Width = shape.Width;
cell2.CellFormat.VerticalAlignment = CellVerticalAlignment.Center;
row.AppendChild(cell2);
row.RowFormat.Height = shape.Height;
row.RowFormat.HeightRule = HeightRule.Exactly;
table.AppendChild(row);
shape.AppendChild(table);
p = new Paragraph(builder.Document);
cell2.AppendChildº;
run = new Run(builder.Document, "A");
p.AppendChild(run);
p.ParagraphFormat.Alignment = ParagraphAlignment.Center;
builder.Document.SaveToPdf(@"h:\out.pdf");
builder.Document.Save(@"h:\out.doc");