How to split document page by page using VB.NET

Hi, Support:
Is there any method to split a document page by page based on VB.net?
I use the DocumentSplitter Class based on C to split document, but it fails.
Could you please rewrite the DocumentSplitter Class into Net Class for me to try?

Dim splitter As Aspose.Words.Examples.CSharp.Loading_Saving.DocumentPageSplitter = New Aspose.Words.Examples.CSharp.Loading_Saving.DocumentPageSplitter(doc)

‘’'However, the object of splitter is nothing, because in the Class PageNumberFinder, the Me.collector is nothing, so that it fails. Could you please debug this class and confirm it success for use.

Thanks!

@ducaisoft

We have attached the VB.NET code of PageSplitter with this post. Hope this helps you.
PageSplitter.zip (4.0 KB)

You can also get the C# code of PageSplitter utility from here:

https://github.com/aspose-words/Aspose.Words-for-.NET

Thanks for your response.
I have test this VB.net code you sent me before,but fail. I do not know why it doesn’t work because the splitter is always nothing after been initiated.
For this updated version, it works! Thanks very much!

@ducaisoft

Please let us know if you still face any issue while using Aspose.Words.

Please note that Aspose.Words requires TrueType fonts when rendering document to fixed-page formats or using PageSplitter utility. You need to install fonts that are used in your document on the machine where you are using this code.

If you still face problem, please ZIP and attach your input Word document and fonts used in your document here for testing.

Hi,Support:
Is there any new method for splitting doc page by page for the api except for this PageSplitter.vb modal?

@ducaisoft You can use Document.ExtractPages method to split document page by page.

Thanks!
And else, is there any method to perform functions by page,for example:

Doc.Pages(1).Rangle.replace(Oldchars,NewCharges)
Doc.Pages(5).Paragraphs(1).Range.Replace(Oldchars,NewChars)
Count=Doc.Pages(8).Paragraphs.count
Doc.Pages.Remove PageStartIndex,PageEndIndex
Doc.Pages.Insert(FromDoc,SrcPageStartIndex,SrcPageEndIndex,DestPageIndex)
......

Or, how to emplement those features?

@ducaisoft No, there are no methods to perform functions by pages. However, you can split the document page by page, perform the required actions and then merge them back using Document.AppendDocument method.

Oh!
Hope this features will be taken into consideration for later versions, for this will unwant split-and-merge steps.

1 Like

@ducaisoft Actually there is no page concept in MS Word documents, since they have flow nature. The consumer applications like MS Word or Open Office layout the document into pages on the fly.
So it is better to take the flow nature of MS Word document into the consideration when work with them.