Skip to content

Commit

Permalink
Revert "Hold cell text inside CTRst and set space to preserve #123"
Browse files Browse the repository at this point in the history
This reverts commit 5512651
  • Loading branch information
Desire456 committed Jul 27, 2021
1 parent f552021 commit d2c90bc
Showing 1 changed file with 2 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import com.opencsv.CSVWriter;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.hssf.usermodel.HSSFDateUtil;
import org.docx4j.XmlUtils;
Expand Down Expand Up @@ -1002,17 +1001,10 @@ protected void updateCell(WorksheetPart worksheetPart, BandData bandData, Cell n
}
} else {
String value = insertBandDataToString(bandData, cellValue);
newCell.setV(value);

//to handle escapes before band values we should set space = preserve and hold value in CTRst
CTRst is = ObjectUtils.defaultIfNull(newCell.getIs(), Context.getsmlObjectFactory().createCTRst());
CTXstringWhitespace t = ObjectUtils.defaultIfNull(is.getT(), Context.getsmlObjectFactory().createCTXstringWhitespace());
t.setValue(value);
t.setSpace("preserve");
is.setT(t);
newCell.setIs(is);
newCell.setV("");
if (newCell.getT() == STCellType.S) {
newCell.setT(STCellType.INLINE_STR);
newCell.setT(STCellType.STR);
}
}
}
Expand Down

0 comments on commit d2c90bc

Please sign in to comment.