Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Document rtfFile = new Document(@"C:ToolsdocwithTextBox.rtf");
- DocumentBuilder builder = new DocumentBuilder(rtfFile);
- var nodes = rtfFile.GetChildNodes(NodeType.Shape, true);
- foreach (Shape shape in nodes)
- {
- if (shape.ShapeType == ShapeType.TextBox)
- {
- var width = shape.Width;
- var height = shape.Height;
- string text = shape.GetText();
- builder.MoveTo(shape);
- shape.Remove();
- Aspose.Words.Tables.Table table = builder.StartTable();
- Cell cell = builder.InsertCell();
- builder.Write(text);
- builder.RowFormat.Height = height;
- builder.RowFormat.HeightRule = HeightRule.Exactly;
- table.PreferredWidth = PreferredWidth.FromPoints(width);
- builder.EndRow();
- builder.EndTable();
- }
- }
- rtfFile.Save(@"C:ToolsdocwithTextBox.rtf");
Add Comment
Please, Sign In to add comment