PDA

View Full Version : Server control saving word to html and spliting pages


phannent
October 19, 2007, 17:16:43
Hello,

I am using the the Server text control and could not find any information as to if the control can split the pages into individual html files.

I have the following code:
serverTextControl1.Load(fileStream, TXTextControl.BinaryStreamType.MSWord);
serverTextControl1.Save(sConvertedFileName, StreamType.HTMLFormat);
serverTextControl1.Dispose();

Which takes an uploaded word document, converts it into html and then further on it will put the html into a database.

I expect the users are going to want to preserve pages so I would need the pages saved individually.

Is this possible?

Many regards
Phil Hannent

Gunnar Giffey
October 19, 2007, 18:01:29
Hello Phil,

Yes, this is possible by selecting the individual pages and using Selection.Save on the selections.
Please note that HTML itself does not support pages.

phannent
October 24, 2007, 15:06:31
Thank you for your reply.

However I have a second question.

I can only see how to select text based on character ranges. What is the method of selecting individual pages.

Many thanks
Phil Hannent

Gunnar Giffey
October 30, 2007, 17:23:46
Phil,

You have to use the InputPosition class to set the cursor at the start of a page:
InputPosition(int page, int line, int column);
Use this character index as Selection.Start.
Then, set the cursor at the end of the page and use the resulting character index as Selection.Lenght.