I want to read particular string from a text file and store them in Excel sheets

前端 未结 4 835
遇见更好的自我
遇见更好的自我 2021-01-24 04:02

My Text file Contains line like this

FLTR TID: 0000003756 RPC ID: 0000108159 USER: Remedy Application Service

FLTR TID: 0000003756 RPC ID: 0

4条回答
  •  长情又很酷
    2021-01-24 04:19

    I would suggest you two improvements which will make it easier to solve your issue.

    1) Do not attempt to write into Excel sheet using Java, its slightly complicated. Instead you can write into a CSV file. You can externally open this CSV file and save as Excel.

    2) The below line might cause trimming of the user names:

     user=str.substring(48,75);   // This is to get user names
    

    Instead you can use

    user=str.substring(48);   // This is to get user names
    

    So, writing a CSV doesn't need Excel libraries and it can be opened in an excel workbook as well. :)

提交回复
热议问题