Click here to Skip to main content
15,883,705 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
is there any solution for below:

if suppose we are having lines as

"abcd defg"

and when we edit say "abcd" to "1234" and when clicked on button then one report should be generated in excel/csv saying below:

FIle name Line number Scanned word Edited word
1.txt 1 abcd 1234

What I have tried:

getting no idea for implementation.googled many search criteria but no result found as needed.
Posted
Updated 26-Jun-20 0:40am

1 solution

You have the name of the source file, so reading line by line and checking for the values to change is a fairly simple matter using the StreamReader, StreamWriter* and String classes. Similarly generating the report values and writing to a .csv file is quite straightforward.

*do not try to edit the file in place if you read line by line. You could simplify it by using ReadAllLines, and then write the results at the end of the scan.
 
Share this answer
 
Comments
shaileshshinde 26-Jun-20 7:00am    
can you please send me sample code as i am not getting idea to implement
Richard MacCutchan 26-Jun-20 8:31am    
Sorry, no. This site does not provide code to order. If you had actually gone to MSDN and looked for the documentation on the classes I suggested, you would have found some sample code.
shaileshshinde 26-Jun-20 9:58am    
Thanks.
I think website name says code of project.so this site is for providing code only.
Richard MacCutchan 26-Jun-20 10:14am    
No that is not what it says, and it is not in any way for providing code. I suggest you carefully read Code Project Quick Answers FAQ[^].

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