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 2017/04/06 13:27:43 UTC
[Bug 60960] New: I want create a xls workbook that the sheets are
greater than 64 and every sheet have comment, but it not work at the version
3.12 and later version.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60960
Bug ID: 60960
Summary: I want create a xls workbook that the sheets are
greater than 64 and every sheet have comment, but it
not work at the version 3.12 and later version.
Product: POI
Version: 3.12-FINAL
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: HSSF
Assignee: dev@poi.apache.org
Reporter: ben.zou@huawei.com
Target Milestone: ---
I want create a xls workbook that the sheets number are greater than 64 and
every sheet has comment, it work at the version 3.10, but it not work at 3.12
and later version. The following code is my test code. The first 63 sheets is
ok, but when the sheets are greater than 64 , it throw the exception "The
exception is Cannot add more than 65535 shapes. "
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFClientAnchor;
import org.apache.poi.hssf.usermodel.HSSFComment;
import org.apache.poi.hssf.usermodel.HSSFPatriarch;
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
public class CellComments {
public static void main(String[] args) {
HSSFWorkbook wb = new HSSFWorkbook();
for (int i = 0; i < 256; i++) {
HSSFSheet sheet = wb.createSheet("Cell comments in POI HSSF" + (i + 1));
// Create the drawing patriarch. This is the top level container for all
shapes including cell comments.
HSSFPatriarch patr = sheet.createDrawingPatriarch();
try {
//create a cell in row 3
HSSFCell cell = sheet.createRow(0).createCell(0);
cell.setCellValue(new HSSFRichTextString("Hello, World"));
//anchor defines size and position of the comment in worksheet
HSSFComment comment = patr.createComment(new HSSFClientAnchor(0, 0, 0,
0, (short) 1, 1, (short) 6, 4));
// set text in the comment
comment.setString(new HSSFRichTextString("We can set comments in POI" +
0));
//set comment author.
//you can see it in the status bar when moving mouse over the commented
cell
comment.setAuthor("Apache Software Foundation");
// The first way to assign comment to a cell is via
HSSFCell.setCellComment method
cell.setCellComment(comment);
} catch (Exception e) {
System.out.printf("Add comment fail at sheet%d. The exception is %s%n",
i+1, e.getMessage());
}
}
try (FileOutputStream out = new FileOutputStream("poi_comment.xls")) {
wb.write(out);
} catch (IOException e) {
e.printStackTrace();
}
}
}
--
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
[Bug 60960] I want create a xls workbook that the sheets are greater
than 64 and every sheet have comment, but it not work at the version 3.12 and
later version.
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60960
--- Comment #2 from chengguang <be...@huawei.com> ---
(In reply to Dominik Stadler from comment #1)
> The HSSF-format (i.e. .xls) is limited in some ways, have you tried using
> the XSSF-classes (.xlsx)?
The xssf-classed is ok. The Hssf-format have the problem. But why it work ok at
the version 3.10, and it not work at 3.12 and later version.
--
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
[Bug 60960] I want create a xls workbook that the sheets are greater
than 64 and every sheet have comment, but it not work at the version 3.12 and
later version.
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=60960
Dominik Stadler <do...@gmx.at> changed:
What |Removed |Added
----------------------------------------------------------------------------
OS| |All
Status|NEW |NEEDINFO
--- Comment #1 from Dominik Stadler <do...@gmx.at> ---
The HSSF-format (i.e. .xls) is limited in some ways, have you tried using the
XSSF-classes (.xlsx)?
--
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