We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Cannot find Currentnode in template

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; text-indent: 47.2px; font: 13.3px 'Courier New'; -webkit-text-stroke: #000000} p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.3px 'Courier New'; -webkit-text-stroke: #000000} p.p3 {margin: 0.0px 0.0px 0.0px 0.0px; text-indent: 47.2px; font: 13.3px 'Courier New'; color: #6a3e3e; -webkit-text-stroke: #6a3e3e} p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.3px 'Courier New'; color: #6a3e3e; -webkit-text-stroke: #6a3e3e} p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.3px 'Courier New'; color: #3f7f5f; -webkit-text-stroke: #3f7f5f} span.s1 {font-kerning: none} span.s2 {text-decoration: underline ; font-kerning: none; color: #6a3e3e; -webkit-text-stroke: 0px #6a3e3e} span.s3 {font-kerning: none; color: #7f0055; -webkit-text-stroke: 0px #7f0055} span.s4 {font-kerning: none; color: #6a3e3e; -webkit-text-stroke: 0px #6a3e3e} span.s5 {font-kerning: none; color: #000000; -webkit-text-stroke: 0px #000000} span.s6 {font-kerning: none; color: #2a00ff; -webkit-text-stroke: 0px #2a00ff} span.s7 {font-kerning: none; color: #0000c0; -webkit-text-stroke: 0px #0000c0}

I have a word dotx document with a end section. See attachment.

In the code I have an Aspose document doc which content is the attachment.

When I execute underlaying code, builder.getCurrentNode cannot be found.

currentNode stay null, and the table is not added to y document.

In other templates it works great. Can you tell me what is the problem with this template?

StringBuilder builder = new StringBuilder();

DatabaseManager dbManager = DatabaseManager.getInstance();

jdbcResults = dbManager.runSqlStatementWithVariables(variabelenInQuery, sqlQuery, slProjectObject, slZaakObject);

DocumentBuilder dbuilder = new DocumentBuilder(doc);

builder.moveToSection(0);

// Specify character formatting for the run of text.

Font f = builder.getFont();

f.setName("Verdana");

f.setSize(8);

// Format the heading row with the appropriate properties.

builder.getFont().setBold(false);

builder.getParagraphFormat().setAlignment(ParagraphAlignment.CENTER);

builder.getCellFormat().setOrientation(TextOrientation.HORIZONTAL);

builder.getCellFormat().setVerticalAlignment(CellVerticalAlignment.CENTER);

builder.getRowFormat().setHeight(11);

builder.getRowFormat().setHeightRule(HeightRule.EXACTLY);

builder.getParagraphFormat().setAlignment(ParagraphAlignment.LEFT);

builder.getParagraphFormat().setRightIndent(0);

builder.getParagraphFormat().setLeftIndent(20);

Node currentNode = builder.getCurrentNode();

while (currentNode != null)

Hi Ernst,

Thanks for your inquiry. We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system as WORDSNET-14570. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.
Hi Ernst,

Thanks for your patience. It is to inform you that the issue which you are facing is actually not a bug in Aspose.Words. So, we have closed this issue (WORDSNET-14570) as 'Not a Bug'.

The first paragraph in body of the first section in your document is empty. When you use the following code, cursor is positioned at the empty paragraph. In this case, CurrentNode returns null.

builder.MoveToSection(0);

Please read the detail of DocumentBuilder.CurrentNode property. When the current paragraph is empty or the cursor is positioned just before the end of the paragraph, CurrentNode returns null.