Parse Document

Technical support for Spire.Doc

Moderator: iceblue support

Parse Document

Postby drpotts » Thu Mar 07, 2013 6:25 am

If I have a document with 500 pages I want go go through the pages and split into a new document each time a new bar code is located. I did this with crude word automation but think Spire.Doc can make this better (no copying to clipboard for one).

In the word automation I loop through the text looking for the barcode font (a 30f9 font). I tried FindAllPattern using \*[a-zA-Z0-9]+\*. This gets me very close because the barcode will always start and end with an *. However I would like to verify the text found has the barcode font.

Any suggestions on how to locate text using a specific font?
Thank You,
Posts: 7
Joined: Thu Mar 07, 2013 3:23 am

Re: Parse Document

Postby » Fri Mar 08, 2013 10:26 am


Thanks for your inquiry.
I think the code(Linq) below can help you:
Code: Select all
doc.FindAllPattern(new Regex(@"*[a-zA-Z0-9]+*"))
    .Select(t => t.GetAsOneRange())
    .Where(r => r.CharacterFormat.FontName == "30f9")

It will find all barcode in your document, each of them is a Spire.Doc.Fields.TextRange object.

If you have any other problem about this issue, please tell us and send us ( your word document.

Best Regards,
Technical Support / Developer,
e-iceblue Support Team
User avatar
Posts: 180
Joined: Mon Nov 08, 2010 3:11 pm

Re: Parse Document

Postby amy.zhao » Tue Mar 12, 2013 10:48 am

Hello drpotts,

Do our previous code help you solve your problem?
Please give us a feedback on this issue at your early convenience. Thank you in advance!
If you have other any problem, please feel free to contact us.

Best regards,
E-iceblue support team
User avatar
Posts: 2241
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.Doc

Who is online

Users browsing this forum: No registered users and 0 guests