How to update existing merged Excel cells with Apache poi -


i can't update existing excel cells these merged , borderd. created excel file styling , use template. @ code-> firstly read excel file , update cells wish. no merge cells ok . merged cells can't insert datas.

it may produce damage excel file or empty data cells. don't want overwrite merged , bordered of existing cells. here code reading , updating..

hashmap<string, bytearrayoutputstream> streams = new hashmap<string, bytearrayoutputstream>(); try {     string appdir = system.getproperty("appdir");     string resoucedir = appdir + system.getproperty("resourcedir");     string templatedir = resoucedir + "/template";     if (streams.keyset().size() <= 0) {         xssfsheet sheet = null;         fileinputstream file = new fileinputstream(new file(templatedir +"/shipping_template.xlsx"));          xssfworkbook workbook = new xssfworkbook(file);         bytearrayoutputstream baos = null;         sheet = workbook.getsheetat(0);         xssfrow shippingrow = sheet.getrow(4);         cell cell = shippingrow.createcell((short) 36);         cell.setcellvalue("doom bringer");         baos = new bytearrayoutputstream();         workbook.write(baos);         streams.put(param, baos);         baos.close();         file.close();     } } 

unfortunately apache poi no longer supported. did 1 version of office 2007 changes way office documents done , no longer support this. had done same exact thing , may want consider using docx4j. regardless need open file stream new document , save onto temp location , make changes new document may corrupt original if try make changes it.


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -