Group,
I am needing to write to a "rtf" file, and always insert my text on line 3 of either a new or an existing rtf document.
I'm familiar with vb, but have not done much with the system.io functions. I have been testing several examples from the internet using the streamreader and streamwriter but still having issues finding a way to "insert text" on a specified line number. My questions:
1)I will always need to write on line #3, do I need to read all lines as this example shows "lines.AddRange(System.IO.File.ReadAllLines("C:/test/myrtffile.rtf"))"
OR
2)Is there a way to simply specify a write and include the line# to write it on, something such as: "write.WriteLine(mytext + vbCrLf, 3)" - the "3" indicating line three. When the write happens on an "existing" rtf document, I want to insert at line 3 and push existing text down the page.
I'm not sure that I need to read text if I know the exact line number that I will always insert my text on.
Any suggestions would be greatly appreciated!!
I am needing to write to a "rtf" file, and always insert my text on line 3 of either a new or an existing rtf document.
I'm familiar with vb, but have not done much with the system.io functions. I have been testing several examples from the internet using the streamreader and streamwriter but still having issues finding a way to "insert text" on a specified line number. My questions:
1)I will always need to write on line #3, do I need to read all lines as this example shows "lines.AddRange(System.IO.File.ReadAllLines("C:/test/myrtffile.rtf"))"
OR
2)Is there a way to simply specify a write and include the line# to write it on, something such as: "write.WriteLine(mytext + vbCrLf, 3)" - the "3" indicating line three. When the write happens on an "existing" rtf document, I want to insert at line 3 and push existing text down the page.
I'm not sure that I need to read text if I know the exact line number that I will always insert my text on.
Any suggestions would be greatly appreciated!!