Click here to Skip to main content
15,884,177 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Am working on creating a simple text editor that also supports image and using richtextbox (winforms) for the same. How to read the content of the richtextbox line by line (that also includes image) and export it to a datatable or a datagrid(from where i will export it to excel). i am able to read the lines if the lines are text. The problem is how to check if a particular line contains image and export it? When i use richtextbox1.rtf.contains('\pict..')it searches the entire text box , how to make it read only the current line. Please help. Thanks in advance.
Posted
Comments
Sinisa Hajnal 18-May-15 7:09am    
Create a loop that goes line by line or isolate the current line somehow and do the search.
Swetha Kannan 18-May-15 9:21am    
ya i tried that and as i said before i am able to read the text but not the image in the line :(
Sinisa Hajnal 18-May-15 10:06am    
You said you searched whole RTF (with rtf.contains('\pict..') ). So...why can't you isolate current line? Once you get the line, you also get if there is a picture in it. Or do I misunderstand something?
Swetha Kannan 19-May-15 2:44am    
ya , i am reading the richtextbox line by line,but i dont know how to search for a picture in a specific line, that is my prob. Couldnt use this "rtf.contains('\pict')" for a specific line.
Sinisa Hajnal 19-May-15 5:44am    
you don't use rtf.contains()., but line.contains...if you're reading line by line simply ask the current line if it contains pict text
line.contains("\pict") or line.IndexOf("\pict") > -1

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