Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Yuri Rubinov
  Where is Yuri Rubinov?
 Philadelphia
 Pennsylvania - United States
 Yuri Rubinov
 To: Michael C. Butler
  Where is Michael C. Butler?
 Austin
 Texas - United States
 Michael C. Butler
 Tags
Subject: RE: Word Doc to XML
Thread ID: 104620 Message ID: 104717 # Views: 1 # Ratings: 0
Version: Visual FoxPro 9 Category: XML
Date: Saturday, August 19, 2006 6:44:53 PM         
   


> Since there is no known HTML parser, and I was not prepared to write one yet, I decided to convert the file from HTML to XML.
> At least that way, I would be able to "find" the data I needed, and export that easily to a text file.
> From there, I wrote a routine, that reads through the file, and extracts the data, and builds my cursors.
>
> However, the XML format that Word 2003 converts the to, is totally unrecognizable to anything except Office 2003 applications, ie. Excel / Word, thus the foxpro parser does nothing for me...
>
> I was simply looking for a better way to parse the data, so I do not have soo many errors in my routine that reads it...
>
> I have attached a sample.zip, which includes the original .DOC file, the .XML file, and the output file where I "extracted" the data from the XML.
>
> From that .TXT file, I am working on a routine, to seperate the data, into the correct cursors.
>
> It is a huge project, and I do not expect you to do anything, I was simply looking for ideas.
>
> Thanks...
> MB
>
> https://www.foxite.com/uploads/f7693b15-ea86-4741-934e-a8bebe745a9c.zip
>
>

Michael,

You have several ways to do it. But none of them is straightforward. At the moment I have only Office2000 that in Word has no XML support as far I know. In subsequent Word versions you will have additional choices, I believe.

Here are some of the approaches you may find workable:

1.Use Word Automation to get field/cell values from each row of the table2 in the document. Number of cells in the row will get you the idea for the group/subgroup/details level recorded on the row.

2. Use Word and Excel Automation to create an Excel file; then import Excel file to the foxpro table, and if you wish, make XML file with cursortoxml().
In Office2000 I was not able to open the file in Excel directly: it always treated it as a Word object, and opened it in the Word Window (even I call it from Excel).
If you have the same problem with Office2003, then copy and paste the word document contents to blank Excel sheet and save it to Excel file. Import from Excelfile, and use curcortoxml() with appropriate nOutputFormat parameter to ctreate an XML file.


Best Wishes,

Yuri Rubinov

ENTIRE THREAD

Word Doc to XML Posted by Michael C. Butler @ 8/18/2006 2:14:20 PM
RE: Word Doc to XML Posted by Yuri Rubinov @ 8/18/2006 3:33:20 PM
RE: Word Doc to XML Posted by Michael C. Butler @ 8/18/2006 5:47:06 PM
RE: Word Doc to XML Posted by Yuri Rubinov @ 8/18/2006 8:56:40 PM
RE: Word Doc to XML Posted by Michael C. Butler @ 8/18/2006 11:28:01 PM
RE: Word Doc to XML Posted by Borislav Borissov @ 8/18/2006 11:42:12 PM
RE: Word Doc to XML Posted by Yuri Rubinov @ 8/19/2006 6:44:53 PM
RE: Word Doc to XML Posted by Steven Holt @ 8/20/2006 2:26:02 AM
RE: Word Doc to XML Posted by Michael C. Butler @ 8/21/2006 5:24:52 PM