Hi Timothy,
Thanks for your inquiry.
First
of all, please note that Aspose.Words is quite different from the
Microsoft Word’s Object Model in that it represents the document as a tree of objects
more like an XML DOM tree. If you worked with any XML DOM library you
will find it is easy to understand and work with Aspose.Words. When you
load a Word document into Aspose.Words, it builds its DOM and all
document elements and formatting are simply loaded into memory. Please
read the following articles for more information on DOM:
https://docs.aspose.com/words/net/aspose-words-document-object-model/
@talba:
Change to carriage return
Change /BS/vvvvv/BE/ to bold characters
You can achieve this by using the same approach shared here:
https://forum.aspose.com/t/66922
@talba:
Delete empty rows in tables.
Please use the following code snippet to delete empty rows.
Document srcDoc = new Document(MyDir + "in.docx");
foreach (Table table in srcDoc.GetChildNodes(NodeType.Table, true))
{
Node[] rows = table.GetChildNodes(NodeType.Row, true).ToArray();
for (int i = 0; i < rows.Length; i++)
{
if (rows[i].ToString(SaveFormat.Text).Trim().Equals(""))
rows[i].Remove();
}
}
srcDoc.Save(MyDir + "out.docx");
@talba:
Insert banding details into headers and footers
Please use DocumentBuilder.MoveToHeaderFooter method to move the cursor to the beginning of a header or footer in the current section and insert the contents according to your requirements. Following code example shows how to insert a watermark image into a document using DocumentBuilder.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
// The best place for the watermark image is in the header or footer so it is shown on every page.
builder.MoveToHeaderFooter(HeaderFooterType.HeaderPrimary);
Image image = Image.FromFile(MyDir + "Watermark.png");
// Insert a floating picture.
Shape shape = builder.InsertImage(image);
shape.WrapType = WrapType.None;
shape.BehindText = true;
shape.RelativeHorizontalPosition = RelativeHorizontalPosition.Page;
shape.RelativeVerticalPosition = RelativeVerticalPosition.Page;
// Calculate image left and top position so it appears in the centre of the page.
shape.Left = (builder.PageSetup.PageWidth - shape.Width) / 2;
shape.Top = (builder.PageSetup.PageHeight - shape.Height) / 2;
doc.Save(MyDir + "DocumentBuilder.InsertWatermark Out.doc");
@talba:
example: { = 200.00 + ’ 125.55’ + 250.00}
With Word, the MERGE functiona handles this and returns a valid formula from the MERGE. With ASPOSE.WORD it would appear it doesn’t and as a result we get Field Error (Sorry but I was not and so I need to update the formula so that it does work. Now if the formula is in a Table cell it is very easy to do but if it is the text of the document I have difficulties.
Please attach your input and expected output MS Word document here for investigation purpose.
@talba:
The other issues I have is that with word MERGE the IF staement is evaluated and the result is returned in the merged document and not the IF statement. With ASPOSE it seems to return the IF statement witth the values (which you can see via the alt F9 function)
{IF 0 > 0 “true”}
This means that if a table cell has an IF statement in it I have to evalute it in order to determine if the row is blank and I can delete it. Again I hhave written code to handles this and it works but is there a way whereby the merge functions reaults just the result and not the evaluated IF statement
Please attach your input and expected output MS Word document here for investigation purpose. We will then provide you more information on this along with code.