Spire.Doc for extracting data

Technical support for Spire.Doc

Moderator: iceblue support

Spire.Doc for extracting data

Postby gdseas » Sat Jun 24, 2017 10:13 pm

Hello,
I went through the site and the forum and need some help understanding if Spire.Doc can help us.

We have an ASP.NET MVC web app and we want to be able to extract data from uploaded Word documents. The documents have a specific table-based structure and we want to be able to read data and store them in our web database columns. Some of the data also has formatting (bold, bullets etc).

From what I have seen so far, Spire.Doc is focused on creating docs rather than extracting data from them. Am i not looking at the right section?

Thank you,
Greg
gdseas
 
Posts: 1
Joined: Sat Jun 24, 2017 10:05 pm

Re: Spire.Doc for extracting data

Postby Betsy.jiang » Mon Jun 26, 2017 7:47 am

Dear Greg,

Sorry for late reply as weekend.
Our Spire.Doc can extract data, please use following code to extract all text from the document.
Code: Select all
String text  = Document.GetText();

And you also can extract the text in Table, here is sample code for your reference.
Code: Select all
            Document doc = new Document(@"Sample.docx");
            Section sec = doc.Sections[0];
            Table table = sec.Tables[0] as Table;
            for (int i = 0; i < table.Rows.Count; i++)
            {
                for (int j = 0; j < table.Rows[i].Cells.Count; j++)
                {
                    TableCell cell = table.Rows[i].Cells[j];
                    foreach (Paragraph para in cell.Paragraphs)
                    {
                        string text = para.Text;
                        ...               
                    }
                }
            }

Hope this can help. If this doesn't meet your requirement, please describe your issue in detail and provide us with a sample document for investigation.

Thanks,
Betsy
E-iceblue support team
User avatar
Betsy.jiang
 
Posts: 1640
Joined: Tue Sep 06, 2016 8:30 am

Re: Spire.Doc for extracting data

Postby Betsy.jiang » Thu Jun 29, 2017 9:39 am

Dear Greg,

How is your issue now ?
Could you please give us some feedbacka at your convenience ?

Thanks,
Betsy
E-iceblue support team
User avatar
Betsy.jiang
 
Posts: 1640
Joined: Tue Sep 06, 2016 8:30 am


Return to Spire.Doc

Who is online

Users browsing this forum: No registered users and 2 guests