You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Adrian Dragulescu <ad...@eskimo.com> on 2009/11/18 19:24:39 UTC
problem with XSSF comments
Hi,
I cannot add comments to an xlsx spreadsheet. I closely followed the
examples but I cannot see what what I'm doing wrong.
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Comment;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFRichTextString;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
public class TestComment {
public static void main(String[] args) throws IOException {
XSSFWorkbook wb = new XSSFWorkbook();
XSSFSheet sheet1 = wb.createSheet("Sheet1");
Row row = sheet1.createRow((short)1);
Cell cell = row.createCell(1);
cell.setCellValue(1);
Comment c1 = sheet1.createComment();
c1.setAuthor("Author 1");
c1.setString(new XSSFRichTextString("Comment 1"));
cell.setCellComment(c1);
Comment c2 = sheet1.createComment();
c2.setAuthor("Author 2");
c2.setString(new XSSFRichTextString("Second Comment"));
c2.setRow(2);
c2.setColumn((short)2);
FileOutputStream fileOut = new
FileOutputStream("C:/Temp/workbook.xlsx");
wb.write(fileOut);
fileOut.close();
System.out.println("Done!");
}
}
The comments don't show up in the file. Am I doing something wrong? I
also tried to use the examples from
http://poi.apache.org/spreadsheet/quick-guide.html#CellComments but I get
the same result.
I'm using Windows XP, and Excel 2007.
Thank you for any suggestions.
Adrian
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: problem with XSSF comments
Posted by Paul Spencer <pa...@apache.org>.
This is known issue, Bug 47188 https://issues.apache.org/bugzilla/show_bug.cgi?id=47188
and Bug 48106 https://issues.apache.org/bugzilla/show_bug.cgi?id=48106
Also see related posts http://poi.markmail.org/search/?q=XSSF+Comment#query
:XSSF%20Comment%20order%3Adate-backward+page:1+state:facets
Paul Spencer
On Nov 18, 2009, at 1:24 PM, Adrian Dragulescu wrote:
>
> Hi,
>
> I cannot add comments to an xlsx spreadsheet. I closely followed
> the examples but I cannot see what what I'm doing wrong.
>
> import java.io.FileOutputStream;
> import java.io.IOException;
>
> import org.apache.poi.ss.usermodel.Cell;
> import org.apache.poi.ss.usermodel.Comment;
> import org.apache.poi.ss.usermodel.Row;
> import org.apache.poi.xssf.usermodel.XSSFRichTextString;
> import org.apache.poi.xssf.usermodel.XSSFSheet;
> import org.apache.poi.xssf.usermodel.XSSFWorkbook;
>
> public class TestComment {
> public static void main(String[] args) throws IOException {
> XSSFWorkbook wb = new XSSFWorkbook();
>
> XSSFSheet sheet1 = wb.createSheet("Sheet1");
>
> Row row = sheet1.createRow((short)1);
> Cell cell = row.createCell(1);
> cell.setCellValue(1);
>
> Comment c1 = sheet1.createComment();
> c1.setAuthor("Author 1");
> c1.setString(new XSSFRichTextString("Comment 1"));
> cell.setCellComment(c1);
>
> Comment c2 = sheet1.createComment();
> c2.setAuthor("Author 2");
> c2.setString(new XSSFRichTextString("Second Comment"));
> c2.setRow(2);
> c2.setColumn((short)2);
>
>
> FileOutputStream fileOut = new FileOutputStream("C:/Temp/
> workbook.xlsx");
> wb.write(fileOut);
> fileOut.close();
>
> System.out.println("Done!");
>
> }
> }
>
>
> The comments don't show up in the file. Am I doing something
> wrong? I also tried to use the examples from http://poi.apache.org/spreadsheet/quick-guide.html#CellComments
> but I get the same result.
>
> I'm using Windows XP, and Excel 2007.
>
> Thank you for any suggestions.
>
> Adrian
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
> For additional commands, e-mail: user-help@poi.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org