Word document format

D

Dan

Is there a way that I can obtain documentation on the format of a Word document file? I need to write a file conversion program in VB. I've tried using the OLE object model, but it's very slow for my purpose.
 
J

Jezebel

It's not publicly available, it's certainly very complex, and rumour has it
that it's polymorphic. Surely a simpler approach would be to create a Word
object -- CreateObject("Word.Application") or Dim x as Word.Application --
and use that to read or write your files?


Dan said:
Is there a way that I can obtain documentation on the format of a Word
document file? I need to write a file conversion program in VB. I've tried
using the OLE object model, but it's very slow for my purpose.
 
G

Guest

There must be something that is wrong because it shouldn't
take that long with the amount of paragraphs that you have.

Loop through each paragraph without writing them to a text
file and see how long it takes.

Mark Baird
-----Original Message-----
I have programmed what I need to do with reading Word
documents using Word.Application in VB. The problem is
that it is extremely slow. My program is simply looping
through the paragraphs in the main story in a sample Word
document and writing them to a text file. I am running
Windows XP Professional on a 2.2 GHz Dell system with Word
2000. My test file is 77 KB, of which the main story
object is about half of the file size. It takes 9 minutes
to loop through the 262 paragraphs and output them to a
text file. Am I doing something wrong that it should take
so long?
To put it in perspective, my program also includes the
capability to convert WordPerfect documents. If this were
a WordPerfect file, this same conversion to a text file
would take 10-20 seconds at the most.
 
J

Jezebel

Agree with the other poster that it shouldn't take so long. I've done a lot
of work with VB and Word; speed has never been an issue. Are you using
exclusively Range objects and working with the Word app invisible? (as
opposed to using the Selection object and Word visible, which can be slow
because Word does all that background repagination)

But in any case, why not just get Word to save the document as a text file?
Or, rather than looping through your paragraphs use something like:

Open MyFile.txt For Output as #Filenum
Print #FileNum, MyDoc.MainStory.Text
Close #FileNum




Dan said:
I have programmed what I need to do with reading Word documents using
Word.Application in VB. The problem is that it is extremely slow. My program
is simply looping through the paragraphs in the main story in a sample Word
document and writing them to a text file. I am running Windows XP
Professional on a 2.2 GHz Dell system with Word 2000. My test file is 77 KB,
of which the main story object is about half of the file size. It takes 9
minutes to loop through the 262 paragraphs and output them to a text file.
Am I doing something wrong that it should take so long?
To put it in perspective, my program also includes the capability to
convert WordPerfect documents. If this were a WordPerfect file, this same
conversion to a text file would take 10-20 seconds at the most.
 
D

Dan

Yes, I am using Range objects exclusively and the Word application is invisible. What you described would indeed work, except that I need to be able to find where various formatting features, such as bold and italics, start and end. For that reason, I was using loops to go through the paragraphs and the characters within each paragraph. I've since been told of an alternate method using the Find and Replace features of a range object that will make it go much faster.

Thanks for your help!

Sincerely,
Dan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top