You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2012/01/18 17:27:13 UTC
DO NOT REPLY [Bug 52484] New: Superscript font works for
XSSFWorkbook but not SXSSFWorkbook
https://issues.apache.org/bugzilla/show_bug.cgi?id=52484
Bug #: 52484
Summary: Superscript font works for XSSFWorkbook but not
SXSSFWorkbook
Product: POI
Version: 3.8-dev
Platform: PC
Status: NEW
Severity: regression
Priority: P2
Component: SXSSF
AssignedTo: dev@poi.apache.org
ReportedBy: gjungman@utilinc.com
Classification: Unclassified
I changed my code to use SXSSFWorkbook (no other change) and my footnotes
(which I superscript) stopped super-scripting. It worked in XSSFWorkbook and
I'm having to roll back.
The below code does the super-scripting. I can send you the Excel files if you
need. Thanks.
footnoteFont = wb.createFont();
footnoteFontSuper = wb.createFont();
footnoteFontSuper.setTypeOffset(Font.SS_SUPER);
...
String fs = footnoteString.toString();
String totalString = header + fs;
RichTextString richString =
createHelper.createRichTextString(totalString);
richString.applyFont(header.length(), totalString.length(),
footnoteFontSuper);
richString.applyFont(0, header.length(), headerFont);
cell.setCellValue(richString);
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
DO NOT REPLY [Bug 52484] Superscript font works for XSSFWorkbook but
not SXSSFWorkbook
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52484
Yegor Kozlov <ye...@dinom.ru> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |WONTFIX
--- Comment #1 from Yegor Kozlov <ye...@dinom.ru> 2012-01-19 17:26:20 UTC ---
Rich text in SXSSF is not supported. All formatting applies via
RichTextString.applyFont() will be lost.
However you can style cells as a whole. Create a cell style with a superscript
font and pass it to Cell.setCellStyle:
CellStyle style = wb.createStyle();
style.setFont(footnoteFontSuper);
...
cell.setCellStyle(style);
Yegor
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
DO NOT REPLY [Bug 52484] Superscript font works for XSSFWorkbook but
not SXSSFWorkbook
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52484
--- Comment #4 from Yegor Kozlov <ye...@dinom.ru> 2012-01-20 07:07:53 UTC ---
It is a conceptual limitation. In a normal Excel file strings are stored in a
special file called Shared String Table (SST) and it acts as a cache of
strings. Cells don't store string values, instead they store a reference into
the SST and two cells holding the same string will have the same reference into
the SST.
An alternative way to store strings is inside cell but in this case only plain
text can be written. Rich text is supported only in SST.
SXSSF is a streaming, forward-only API and it writes data immediately as it is
passed to the API. This means that SXSSF does not cache strings. When a rich
text string is passed it is converted into plain text and written as a plain
text cell value. I don't see an easy way to improve it.
If you want all Excel features then give more memory to Java and use XSSF.
P.S. I'm going to reflect it in the documentation. The Spreadsheet API feature
summary (http://poi.apache.org/spreadsheet/index.html) should explicitly say
that rich text is not supported in SXSSF.
Yegor
(In reply to comment #2)
> Thanks for the reply, Yegor.
>
> Will it ever be supported?
>
> Your suggestion wouldn't look like a footnote, as either the entire cell would
> be superscripted, or the footnotes would float off away from the text in their
> own superscript column, which defeats the logic behind a super-script.
>
> In HTML and Java Swing you can superscipt:
>
> My Row Header <sup>(1)</sup)
> My Second Row Header
> Third <sup>(2)></sup>
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
DO NOT REPLY [Bug 52484] Superscript font works for XSSFWorkbook but
not SXSSFWorkbook
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52484
--- Comment #6 from Yegor Kozlov <ye...@dinom.ru> 2012-01-20 11:06:46 UTC ---
In theory we can stream SST too. In this case it wouldn't be a cache of strings
- we will simply write out strings and set the SST index in the cell.
It is not trivial and will take some time to implement. The starting point is
SSTDataWriter which will convert rich text to xml and write into a temp file.
The implementation should be similar to SheetDataWriter which does this job for
cells and rows. SSTDataWriter should keep track of the last written index and
total number of entries in the SST.
Next we will tweak SXSSF to delegate string data to SSTDataWriter and update
the SST index in the cell.
This is something to plan for POI-3.9. Until we release 3.8-final I would stay
on the safe side and keep SXSSF as it is.
Yegor
(In reply to comment #5)
> How does the SST differ from the Styles table, which is also maintained in
> memory and referenced by the streaming SXSSF?
> In other words, whilst SXSSF obviusly couldn't work if all cells were RichText
> (because the SST would have to be in memory and SXSSF wouldn't gain you
> anything) couldn't it still be beneficial if only a minority of the cells are
> RichText?
>
> We'd need to have an option to tell SXSSF which way to handle RichText, but for
> my circumstance it would work (I usually have either huge sheets or fancy
> sheets, but I don't know which until after I've started outputting them).
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
DO NOT REPLY [Bug 52484] Superscript font works for XSSFWorkbook but
not SXSSFWorkbook
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52484
Greg Jungman <gj...@utilinc.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |gjungman@utilinc.com
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
DO NOT REPLY [Bug 52484] Superscript font works for XSSFWorkbook but
not SXSSFWorkbook
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52484
--- Comment #3 from Jim Talbut <ji...@spudsoft.co.uk> 2012-01-19 19:18:32 UTC ---
Yegor,
Is it a vast amount of work to get RichText support in SXSSF?
I can't use SXSSF without it :(
I'm swamped at the moment, but I should be able to give some time to it
soon(ish) if you can lay out what needs doing.
Jim
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
DO NOT REPLY [Bug 52484] Superscript font works for XSSFWorkbook but
not SXSSFWorkbook
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52484
Greg Jungman <gj...@utilinc.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
OS/Version| |All
Severity|regression |critical
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
DO NOT REPLY [Bug 52484] Superscript font works for XSSFWorkbook but
not SXSSFWorkbook
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52484
--- Comment #5 from Jim Talbut <ji...@spudsoft.co.uk> 2012-01-20 09:30:19 UTC ---
How does the SST differ from the Styles table, which is also maintained in
memory and referenced by the streaming SXSSF?
In other words, whilst SXSSF obviusly couldn't work if all cells were RichText
(because the SST would have to be in memory and SXSSF wouldn't gain you
anything) couldn't it still be beneficial if only a minority of the cells are
RichText?
We'd need to have an option to tell SXSSF which way to handle RichText, but for
my circumstance it would work (I usually have either huge sheets or fancy
sheets, but I don't know which until after I've started outputting them).
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
DO NOT REPLY [Bug 52484] Superscript font works for XSSFWorkbook but
not SXSSFWorkbook
Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=52484
--- Comment #2 from Greg Jungman <gj...@utilinc.com> 2012-01-19 18:13:45 UTC ---
Thanks for the reply, Yegor.
Will it ever be supported?
Your suggestion wouldn't look like a footnote, as either the entire cell would
be superscripted, or the footnotes would float off away from the text in their
own superscript column, which defeats the logic behind a super-script.
In HTML and Java Swing you can superscipt:
My Row Header <sup>(1)</sup)
My Second Row Header
Third <sup>(2)></sup>
--
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org