Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I am using Visual Studio 2010, C#.

I have some Word files.
I want to insert each page of Word files into a record from the database.

How do I split the Word file on every page?


In the following example, "Text field" must contain text and formatting of each page.

Sample:::
SQL
CREATE TABLE [Book] (
  [id] integer NOT NULL PRIMARY KEY AUTOINCREMENT,
  [Section] nvarchar(50) NOT NULL,
  [Chapter] nvarchar(50) NOT NULL,
  [PageNumber] int NOT NULL,

  [Text] ntext NOT NULL,

  [Refrence] ntext NOT NULL,
  [KeyWords] ntext NOT NULL);


Thank you very much for your tips.
Posted
Comments
eJuliet 16-Nov-14 9:56am    
tnx, I'll read it.
[no name] 16-Nov-14 10:10am    
You are welcome. But unfortunately I was not really a big help :( Please have a close look to the answer from Kornfeld Eliyahu Peter. For me it is a very good explanation.
Bruno
eJuliet 16-Nov-14 10:32am    
Thank you,
But he was unpromising for me!

1 solution

Word document do not contain pages, but a text flow...
The Page[^] object you can find in the Word Object Model[^] does not represent a container, but a visual block of formatting.
The Page as container of part of the content get meaning only after the actual rendering (visualization) of the document...That the reason that Word document can be very different on different computers (in contrast or PDF)...
So, you can not read pages from a word document - they are not there...
 
Share this answer
 
Comments
Kornfeld Eliyahu Peter 16-Nov-14 7:50am    
So?
If you read carefully the link, you can see that there is no such object 'page' in Word. All those solution are do phrase (render) the document at hand to say where the next/previous page should be - and that computation depends on the current surface (print/screen) definitions, so running the very same code on an other computer may give you a different result...
So the only sure way to break a Word document to absolute pages (not dependent on computation) is to turn it to something like PDF...
[no name] 16-Nov-14 7:58am    
Thanks.+5
Bruno
Kornfeld Eliyahu Peter 16-Nov-14 8:02am    
Thank you...
eJuliet 16-Nov-14 10:07am    
Therefore,
For create a table with this sample structure,
What is your suggestion?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900