You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Eric Peters <Er...@Peters.org> on 2013/07/12 17:50:52 UTC

Trying to write test cases for parsing...How can I create an "inlineStr" in an Excel file?

Hey All ~

I have some XLSX Streaming Code in Scala that is heavily based upon:
http://svn.apache.org/repos/asf/poi/trunk/src/examples/src/org/apache/poi/xssf/eventusermodel/XLSX2CSV.java

Even in the example code there is a big glaring comment:

                    case INLINESTR:
                        // TODO: have seen an example of this, so it's
untested.
                        XSSFRichTextString rtsi = new
XSSFRichTextString(value.toString());
                        thisStr = '"' + rtsi.toString() + '"';
                        break;

I'm looking for how to create an example cell that is of type "inlineStr"
within Excel itself, so I can make sure to have better coverage in my unit
testing.  Any tips?

Thanks,

Eric

Re: Trying to write test cases for parsing...How can I create an "inlineStr" in an Excel file?

Posted by Darren Roberts <ro...@yahoo.com>.
Hi Eric

You can create an xlsx file using the SXSSFWorkbook (streaming xssf) as that will only use inline strings - it does not use the shared strings table. Then use the created file for your testing.


Regards
Darren




>________________________________
> From: Eric Peters <Er...@Peters.org>
>To: user@poi.apache.org 
>Sent: Friday, July 12, 2013 4:50 PM
>Subject: Trying to write test cases for parsing...How can I create an "inlineStr" in an Excel file?
> 
>
>Hey All ~
>
>I have some XLSX Streaming Code in Scala that is heavily based upon:
>http://svn.apache.org/repos/asf/poi/trunk/src/examples/src/org/apache/poi/xssf/eventusermodel/XLSX2CSV.java
>
>Even in the example code there is a big glaring comment:
>
>                    case INLINESTR:
>                        // TODO: have seen an example of this, so it's
>untested.
>                        XSSFRichTextString rtsi = new
>XSSFRichTextString(value.toString());
>                        thisStr = '"' + rtsi.toString() + '"';
>                        break;
>
>I'm looking for how to create an example cell that is of type "inlineStr"
>within Excel itself, so I can make sure to have better coverage in my unit
>testing.  Any tips?
>
>Thanks,
>
>Eric
>
>
>