Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Thu May 25, 2017 3:46 pm

Does Spire.Doc now support footnotes when converting from DOCX to PDF?

alacroce
 
Posts: 4
Joined: Thu May 25, 2017 2:59 pm

Fri May 26, 2017 3:07 am

Dear alacroce,

Thanks for your inquiry.
Yes, Spire.Doc already supports that. Please use the latest Spire.Doc Pack(hot fix) Version:5.9.16. If there is any question, please let me know.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Tue May 30, 2017 3:06 pm

Hi Betsy,
I am creating a rather complex document that includes many footnotes. A footnote may be reference several times on a single page, how do I create a reference to the same footnote?

Secondly, can I find out what page a paragraph or footnote is located?

Thanks.

alacroce
 
Posts: 4
Joined: Thu May 25, 2017 2:59 pm

Wed May 31, 2017 2:39 am

Dear alacroce,

Thanks for your inquiry.
Here is sample code for creating same footnote.
Code: Select all
            Document document = new Document();
            document.LoadFromFile(@"F:\testing\doc form\original document\10099.docx");
            Section section = document.Sections[0];
            //add footnote
            Paragraph paragraph = section.Paragraphs[0];
            Footnote footnote = paragraph.AppendFootnote(FootnoteType.Footnote);
            footnote.TextBody.AddParagraph().AppendText("First");

            //insert bookmart includes the footnote
            BookmarkStart start = new BookmarkStart(document, "_FootNote1");           
            BookmarkEnd end = new BookmarkEnd(document, "_FootNote1");
            paragraph.ChildObjects.Insert(paragraph.ChildObjects.IndexOf(footnote), start);
            paragraph.ChildObjects.Insert(paragraph.ChildObjects.IndexOf(footnote)+1, end);

            //add a cross-reference field, and link it to the bookmark
            Field Field = new Field(document);
            Field.Type = FieldType.FieldNoteRef;
            Field.Code = @" NOTEREF _FootNote1 \f \h  \* MERGEFORMAT ";

            //add it into the place where reference the same footnote.
            section.Paragraphs[1].ChildObjects.Add(Field);
            FieldMark fieldmark = new FieldMark(document, FieldMarkType.FieldSeparator);
            section.Paragraphs[1].ChildObjects.Add(fieldmark);
           
            TextRange tr = new TextRange(document);
            tr.Text = "1";
            tr.CharacterFormat.SubSuperScript = SubSuperScript.SuperScript;
            section.Paragraphs[1].ChildObjects.Add(tr);

            FieldMark fieldEnd = new FieldMark(document, FieldMarkType.FieldEnd);
            section.Paragraphs[1].ChildObjects.Add(fieldEnd);
           
            document.SaveToFile("sameFootNote10101.docx", FileFormat.Docx);

As for the second issue, sorry that it is impossible to achieve, since MS Word document is flow document and does not contain any information about its layout into lines and pages.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.Doc