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

Free Support Forum - aspose.com

How to insert a footnote into a list via documentbuilder

Hello,

again a question: i’m trying to insert a footnote (or more) in list items. Is there a more detailes documentation available ?



I have several questions here:



first: how can I add a footnote(s) at the end of an list-item ?

(inside works well: builder.write(…); builder.insertFootnote(…); builder.writeln(…):wink:



second: how can I prevent the builder to put the last footnote(s) below (and not inside) the list ?



thanks a lot !



best regards,

christian

Hi Christian,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry.

1. List items in MS Word documents are just regular paragraphs, but with special settings. So if you need to insert footnote at the end of an list item, you should just insert this footnote at the end of the paragraph, which represents this list item. As you mentioned the following construction should work fine for you:

builder.write(...); builder.insertFootnote(...); builder.writeln(...);

2. I am afraid I do not fully understand your question. Could you please provide me sample document and code, which will demonstrate the problem? I will check the issue and provide you more information.

Best regards.

Hi Alexey,



well - here’s my sample - the code:



builder.getListFormat().setListLevelNumber(0);

builder.getListFormat().setList(list);

builder.write(“dobedoo”);

builder.getListFormat().setListLevelNumber(1);

builder.write(“dobedoo dam dam”);

builder.insertFootnote(FootnoteType.FOOTNOTE, “Fussnote hier”);

builder.writeln(“dam dam dobedoo”);

builder.getListFormat().setListLevelNumber(2);

builder.writeln(“damdam dobedoo”);

builder.insertFootnote(FootnoteType.FOOTNOTE, “Footnote”);

builder.insertFootnote(FootnoteType.FOOTNOTE, “more Footnotes”);

builder.getListFormat().setListLevelNumber(1);

builder.writeln(“damdam”);

builder.insertFootnote(FootnoteType.FOOTNOTE, “und die letzte Fussnote”);

builder.getListFormat().setListLevelNumber(0);

builder.write( “…”);



builder.getListFormat().removeNumbers();



// Save the documents.

doc.save(“new_test.doc”);





and the word Document part is attached.



As you can see the first footnote works well - the footnotes two and three i’d expect on list item earlier and the fourth one i’d also expect INSIDE the list not outside…





thanks and best regards,

christian



ps: where can i add the format options for the footnote numbering using the documentBuilder ?

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thank you for additional information. I modified your code and now it works as expected:

// insert the first list item

builder.getListFormat().setList(list);

builder.getListFormat().setListLevelNumber(0);

// each list item ends with paragraph break. WriteLn method insertes paragraph break.

builder.writeln("dobedoo");

// Insert the second list item and increase list level

builder.getListFormat().setListLevelNumber(1);

builder.write("dobedoo dam dam");

builder.insertFootnote(FootnoteType.FOOTNOTE, "Fussnote hier");

builder.writeln("dam dam dobedoo");

// Insert the third list item and increase list level

builder.getListFormat().setListLevelNumber(2);

builder.write("damdam dobedoo");

builder.insertFootnote(FootnoteType.FOOTNOTE, "Footnote");

builder.insertFootnote(FootnoteType.FOOTNOTE, "more Footnotes");

builder.writeln();

// Insert one more item and decrese list level

builder.getListFormat().setListLevelNumber(1);

builder.write("damdam");

builder.insertFootnote(FootnoteType.FOOTNOTE, "und die letzte Fussnote");

builder.writeln();

// Remove numbering

builder.getListFormat().removeNumbers();

builder.write("...");

Hope this helps. Please let me know if you need more assistance, I will be glad to help you.

Best regards.

Hi Alexey,


first i wanted to thank you for your valuable help.

I have another question about footnotes:
Are there more options to format the appearance of the footnotes execpt vom the NumberStyle and Position ?!? (FootnoteOptions)

I’d like to have some controls about indent and also the NumberFormat (as used for lists).

Are there options to get some more hands on the format of the footnotes ?

thanks a lot and best regards,
christian

Hi Christian,

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. The only way to format appearance of footnotes in the document is using FootnoteOptions:

http://www.aspose.com/documentation/java-components/aspose.words-for-java/com/aspose/words/footnoteoptions.html

If you need to change font of footnotes, you can achieve this by creating Footnote from scratch. Please see the following link for more information:

http://www.aspose.com/documentation/java-components/aspose.words-for-java/com/aspose/words/footnote.html

Hope this helps. Please let me know if you need more assistance, I will be glad to help you.

Best regards.