Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Thu Mar 07, 2013 6:25 am

Hello,
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,

drpotts
 
Posts: 7
Joined: Thu Mar 07, 2013 3:23 am

Fri Mar 08, 2013 10:26 am

Hi,

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 (support@e-iceblue.com) your word document.

Best Regards,
Harry
Harry
Technical Support / Developer,
e-iceblue Support Team
User avatar

harry.support
 
Posts: 180
Joined: Mon Nov 08, 2010 3:11 pm

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,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2766
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.Doc