Click here to Skip to main content
15,892,643 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

i have a rtf file. in which have the following bookmarks.


CSS
Patient Name   
Medical Record Number   
Date of Birth   
Sex


at the following data in rtf file.

CSS
Patient Name    : FRANKEL, CHARLES
Medical Record Number   : 3285311
Date of Birth   : 12/28/1958
Sex : Male





in my project i want to get the values of these bookmarks from rtf file using c#.

that is ,

CSS
FRANKEL, CHARLES
3285311
12/28/1958
Male




how to get data which is in this bookmarks from rtf file?

Thanks.
Posted
Updated 7-Nov-13 0:50am
v3

1 solution

I would do two things:
1. download a copy of the RTF specification and find out how bookmarks are stored
2. study the raw RTF text of a sample input file containing one or more bookmarks, confirm that they are encoded consistently with what is described in the spec ... and that you understand that encoding.

Now, you'll know what your code must search for in the RTF. How you write a parser (even, a simple scanner) is probably determined by the other goals of your program (do you need to extract other information from the file? Is that information correlated with the bookmarks? etc.)

An alternative to dealing with the raw RTF is to use MS Office automation and use the Word API to find and extract the bookmarks. Of course, this route requires that your run time environment has MS Word installed.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900