I would like to describe my problem here:
I want to insert a field in a particular page of a word document. So i am looking for a method in Aspose API where I give a page number to it and it allows me to insert a field code at the top of that page. Or is there anything in Aspose API to do this?
Looking forward to your response!
Is DocumentLayoutHelper of part of Dot Net Samples code only? I could not find it in samples code of java.
Looking forward to your response.
Document doc = new
Document(MyDir + “in.docx”);<o:p></o:p>
int page = 0;
LayoutCollector lc = new LayoutCollector(doc);
ArrayList nodes = new ArrayList();
//Loop though Paragraphs
for (Paragraph para : (Iterable<Paragraph>)doc.getChildNodes(NodeType.PARAGRAPH, true))
//Add frist run node to ArrayList
if (page != lc.getStartPageIndex(para))
page = lc.getStartPageIndex(para);
DocumentBuilder builder = new DocumentBuilder(doc);
for (Run run : (Iterable<Run>)nodes)
builder.insertField("MERGEFIELD MyFieldName \\* MERGEFORMAT");
doc.save(MyDir + "out.docx");
Thanks a lot for the help … It doesn’t solve our problem completely. But it’s helpful.
I will wait till you bring up DocumentLayoutHelper for java.
Thanks for being patient. Please try the attached DocumentLayoutHelper utility for Java. I hope, this helps.