Are there some code examples of how to use Aspose.Word and/or Aspose.PDF to read the TOC fields in an existing Word doc? My situation is:
I’m using Aspose.Word and Aspose.PDF to generate a PDF file from existing Word documents. The Word document has all the Header# fields defined, but does not contain the generated TOC.
Creating the PDF file is working well, and I was hoping to be able to extract the Header1/Header2/Header3 etc fields from the Aspose-generated XML file to store in a database table, but there is nothing about the nodes created in the XML file that can clearly identify either the Header level or the sequence of entries. There is an ID field, however the sequence numbering often appears to be out of sync with the order of entries in the Word doc, and I suspect this is if the Word doc is subsequently edited.
This is my code for creating the pdf file:
public byte createPdf(string input)
string strFilename = System.IO.Path.GetFileName(input);
string workPath = input.Substring(0, input.Length - strFilename.Length);
string fileBase = System.IO.Path.GetFileNameWithoutExtension(strFilename);
string xmlFile = workPath + fileBase + “.xml”;
string pdfFile = workPath + fileBase + “.pdf”;
Aspose.Word.Document doc = new Aspose.Word.Document(input);
Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();
pdf.IsImagesInXmlDeleteNeeded = true;
catch (Exception exc)