I seek your advice. I have a document with a table across multiple pages in one Section. The table has the first main row. When I use DocumenPageSplitter, I split the document into Sections. The table header is only in the first section. It is not repeated in others.
How do I get the table divided into sections and at the same time the main row is repeated in the others?
First Row = HeadingFormat = true
DocumentPageSPlitter = https://github.com/aspose-words/Aspose.Words-for-.NET
thank you for answer
@benestom With the latest version you do not need to use DocumentPageSplitter
. You can use a built-in Document.ExtractPages method:
Document doc = new Document(@"C:\Temp\in.docx");
for (int i = 0; i < doc.PageCount; i++)
doc.ExtractPages(i, 1).Save(string.Format(@"C:\Temp\page_{0}.docx", i));
Using this method header row of the table will be exported properly.
Good day,
thank you for answer. I need a document to divide each page into a separate section. (Example input 1 section with 30 pages - output 30 sections in one document.) How easily with this function. Without losing styles, formatting and so on …
@benestom You can achieve this using code like the following:
Document doc = new Document(@"C:\Temp\in.docx");
// Clone the original document without content.
Document dstDoc = (Document)doc.Clone(false);
// Put each page a a separate section into the empty document.
for (int i = 0; i < doc.PageCount; i++)
dstDoc.AppendDocument(doc.ExtractPages(i, 1), ImportFormatMode.UseDestinationStyles);
dstDoc.Save(@"C:\Temp\out.docx");