Bug 63494 - If multiple Sheets contains RichText then on combining them into one workbook, RichText cell appears as blank from sheet 2 onward
Summary: If multiple Sheets contains RichText then on combining them into one workbook...
Status: RESOLVED WORKSFORME
Alias: None
Product: POI
Classification: Unclassified
Component: OPC (show other bugs)
Version: unspecified
Hardware: PC All
: P2 critical (vote)
Target Milestone: ---
Assignee: POI Developers List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-10 09:27 UTC by Pramod
Modified: 2019-06-25 07:06 UTC (History)
0 users



Attachments
attached zip file contains 2 excel sheet and the generated output (27.28 KB, application/x-zip-compressed)
2019-06-10 09:27 UTC, Pramod
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pramod 2019-06-10 09:27:16 UTC
Created attachment 36620 [details]
attached zip file contains 2 excel sheet and the generated output

I have multiple Excel sheet, each sheet contains few RichText Cell but when i combine all Excel sheet into a single workbook using poi-ooxml then first sheet appears correctly but in subsequent sheets we lost our RichText cell value and cell appears as blank.
Comment 1 Dominik Stadler 2019-06-20 11:18:13 UTC
Can you provide the sample-code which produces those files? Ideally as self-sufficient test-case so others can run it.

Otherwise it is hard to exactly reproduce the problem that you are facing.
Comment 2 Pramod 2019-06-25 07:06:03 UTC
This issue is now fixed for me.
i have added below lines of code when relationship type is Shared String:

sd = SstDocument.Factory.parse(p.getInputStream());
			targetsd = SstDocument.Factory.parse(partTarget.getInputStream());
			List<CTRst> ctRstArray = sd.getSst().getSiList();
			String sharedString = null;
			for (CTRst ctRst : ctRstArray) {
				if(ctRst.getRList() != null && ctRst.getRList().size()>0){
					List<CTRElt> rList = ctRst.getRList();
					targetsd.getSst().addNewSi().getRList().addAll(rList);
				}else if(ctRst.getRPhList() != null && ctRst.getRPhList().size() > 0){
					List<CTPhoneticRun> rphList = ctRst.getRPhList();
					targetsd.getSst().addNewSi().getRPhList().addAll(rphList);
				}else {
					sharedString = ctRst.getT();
					CTRst ctrst = targetsd.getSst().addNewSi();
					ctrst.setT(sharedString);
				}
			}



earlier the lines of code was:

sd = SstDocument.Factory.parse(p.getInputStream());
			targetsd = SstDocument.Factory.parse(partTarget.getInputStream());
			List<CTRst> ctRstArray = sd.getSst().getSiList();
			String sharedString = null;
			for (CTRst ctRst : ctRstArray) {
			
					sharedString = ctRst.getT();
					CTRst ctrst = targetsd.getSst().addNewSi();
					ctrst.setT(sharedString);				
			}