Hi,
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!
Hi,
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.
Hi,
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))
{
if(para.hasChildNodes())
{
page = lc.getStartPageIndex(para);
nodes.add(para.getRuns().get(0));
}
}
}
DocumentBuilder builder = new DocumentBuilder(doc);
for (Run run : (Iterable<Run>)nodes)
{
builder.moveTo(run);
builder.insertField("MERGEFIELD MyFieldName \\* MERGEFORMAT");
}
doc.save(MyDir + "out.docx");
Hi,
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.
Hi there,
Hi there,
Thanks for being patient. Please try the attached DocumentLayoutHelper utility for Java. I hope, this helps.
The issues you have found earlier (filed as WORDSJAVA-740) have been fixed in this .NET update and this Java update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(2)