Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to modify FileInputStream?  RSS feed

 
Gaurav Kr. Arora
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a excel based html file which is not standard and is not getting read by Aspose or Apache POI like a normal html or excel file.
When I open that html file in excel and then add any character to the file or delete any character from the file and save the file and try to open again using Aspose.Cells file gets opened.

I am trying to find a way to solve this. I can read that file using FileInputStream into byte array and then if I modify this byte array by adding a byte into it and then creating an inputstream, this might solve the problem. But how to do this?

Also, if any other way is there to solve the issue, kindly let me know.

Thanks in advance.
Vineet
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is an "excel based HTML file"? Either it's XLS (or XLSX) or it is HTML - which one is it? POI only knows how to handle XLS/XLSX.
 
Gaurav Kr. Arora
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Html file can be opened in excel and we can save excel sheet as webpage(*.htm, *.html). My file is actually a html file which is not getting read by Aspose.Cells but if I can modify it programmatically, Aspose.Cells will read.

How can I add/delete a byte or a character to an inputstream of this particular file.

PS: The file contains lots of records may be around 10K records.
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, so it is an HTML file. That makes it text, and so it's possible to use string operations on such a file. Instead of using Streams you can use Readers and Writers (make sure to use the proper encoding). You need to be careful not to alter the HTML structure by replacing or deleting HTML tags.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!