本文整理了Java中org.apache.poi.xssf.usermodel.XSSFComment
类的一些代码示例,展示了XSSFComment
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XSSFComment
类的具体详情如下:
包路径:org.apache.poi.xssf.usermodel.XSSFComment
类名称:XSSFComment
暂无
代码示例来源:origin: org.apache.poi/poi-ooxml
@Override
public void cell(String cellRef, String formattedValue, XSSFComment comment) {
if (firstCellOfRow) {
firstCellOfRow = false;
} else {
output.append('\t');
}
if (formattedValue != null) {
checkMaxTextSize(output, formattedValue);
output.append(formattedValue);
}
if (includeCellComments && comment != null) {
String commentText = comment.getString().getString().replace('\n', ' ');
output.append(formattedValue != null ? " Comment by " : "Comment by ");
checkMaxTextSize(output, commentText);
if (commentText.startsWith(comment.getAuthor() + ": ")) {
output.append(commentText);
} else {
output.append(comment.getAuthor()).append(": ").append(commentText);
}
}
}
代码示例来源:origin: org.apache.poi/poi-ooxml
public void setString(String string) {
setString(new XSSFRichTextString(string));
}
代码示例来源:origin: org.apache.poi/poi-ooxml
int column1 = o1.getColumn();
int column2 = o2.getColumn();
return o1.hashCode() - o2.hashCode();
int newColumnIndex = shiftedRowNum(startColumnIndex, endColumnIndex, n, columnIndex);
if(newColumnIndex != columnIndex){
XSSFComment xssfComment = new XSSFComment(sheetComments, comment,
vml == null ? null : vml.findCommentShape(ref.getRow(), columnIndex));
commentsToShift.put(xssfComment, newColumnIndex);
entry.getKey().setColumn(entry.getValue());
代码示例来源:origin: org.apache.poi/poi-ooxml
/**
* Set the row of the cell that contains the comment
*
* If changing both row and column, use {@link #setAddress}.
*
* @param row the 0-based row of the cell that contains the comment
*/
@Override
public void setRow(int row) {
setAddress(row, getColumn());
}
代码示例来源:origin: org.apache.poi/poi-ooxml
@Override
public int hashCode() {
return ((getRow()*17) + getColumn())*31;
}
代码示例来源:origin: org.apache.poi/poi-ooxml
/**
* Set the column of the cell that contains the comment
*
* If changing both row and column, use {@link #setAddress}.
*
* @param col the 0-based column of the cell that contains the comment
*/
@Override
public void setColumn(int col) {
setAddress(getRow(), col);
}
代码示例来源:origin: org.apache.poi/poi-ooxml
int row1 = o1.getRow();
int row2 = o2.getRow();
return o1.hashCode() - o2.hashCode();
XSSFComment xssfComment = new XSSFComment(sheetComments, comment,
vml == null ? null : vml.findCommentShape(rownum, ref.getCol()));
entry.getKey().setRow(entry.getValue());
代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev
/**
* Creates a comment.
* @param anchor the client anchor describes how this comment is attached
* to the sheet.
* @return the newly created comment.
*/
public XSSFComment createCellComment(ClientAnchor anchor) {
XSSFClientAnchor ca = (XSSFClientAnchor)anchor;
XSSFSheet sheet = (XSSFSheet)getParent();
//create comments and vmlDrawing parts if they don't exist
CommentsTable comments = sheet.getCommentsTable(true);
XSSFVMLDrawing vml = sheet.getVMLDrawing(true);
schemasMicrosoftComVml.CTShape vmlShape = vml.newCommentShape();
if(ca.isSet()){
String position =
ca.getCol1() + ", 0, " + ca.getRow1() + ", 0, " +
ca.getCol2() + ", 0, " + ca.getRow2() + ", 0";
vmlShape.getClientDataArray(0).setAnchorArray(0, position);
}
XSSFComment shape = new XSSFComment(comments, comments.newComment(), vmlShape);
shape.setColumn(ca.getCol1());
shape.setRow(ca.getRow1());
return shape;
}
代码示例来源:origin: org.apache.poi/poi-ooxml
/**
* Finds the cell comment at cellAddress, if one exists
*
* @param cellAddress the address of the cell to find a comment
* @return cell comment if one exists, otherwise returns null
*/
@Override
public XSSFComment findCellComment(CellAddress cellAddress) {
CTComment ct = getCTComment(cellAddress);
return ct == null ? null : new XSSFComment(this, ct, null);
}
代码示例来源:origin: ZuInnoTe/hadoopoffice
@Override
public void cell(String cellReference, String formattedValue, XSSFComment comment) {
// create empty column, if needed
CellAddress currentCellAddress = new CellAddress(cellReference);
for (int i=this.currentColumn;i<currentCellAddress.getColumn();i++) {
this.spreadSheetCellDAOCurrentRow.add(null);
this.currentColumn++;
}
// add column
SpreadSheetCellDAO currentDAO = null;
if (comment!=null) {
currentDAO = new SpreadSheetCellDAO(formattedValue,comment.getString().getString(), "", cellReference,this.sheetName);
} else {
currentDAO = new SpreadSheetCellDAO(formattedValue,"", "", cellReference,this.sheetName);
}
this.currentColumn++;
this.spreadSheetCellDAOCurrentRow.add(currentDAO);
}
@Override
代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev
/**
* Assign a cell comment to a cell region in this worksheet
*
* @param cellRef cell region
* @param comment the comment to assign
* @deprecated since Nov 2009 use {@link XSSFCell#setCellComment(org.apache.poi.ss.usermodel.Comment)} instead
*/
@Deprecated
public static void setCellComment(String cellRef, XSSFComment comment) {
CellReference cellReference = new CellReference(cellRef);
comment.setRow(cellReference.getRow());
comment.setColumn(cellReference.getCol());
}
代码示例来源:origin: org.apache.poi/poi-ooxml
/**
* Creates a new XSSFComment, associated with a given
* low level comment object.
*/
public XSSFComment(CommentsTable comments, CTComment comment, CTShape vmlShape) {
_comment = comment;
_comments = comments;
_vmlShape = vmlShape;
// we potentially need to adjust the column/row information in the shape
// the same way as we do in setRow()/setColumn()
if(comment != null && vmlShape != null && vmlShape.sizeOfClientDataArray() > 0) {
CellReference ref = new CellReference(comment.getRef());
CTClientData clientData = vmlShape.getClientDataArray(0);
clientData.setRowArray(0, new BigInteger(String.valueOf(ref.getRow())));
clientData.setColumnArray(0, new BigInteger(String.valueOf(ref.getCol())));
avoidXmlbeansCorruptPointer(vmlShape);
}
}
代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev
/**
* Set the row of the cell that contains the comment
*
* @param row the 0-based row of the cell that contains the comment
*/
public void setRow(int row) {
String oldRef = _comment.getRef();
String newRef =
(new CellReference(row, getColumn())).formatAsString();
_comment.setRef(newRef);
_comments.referenceUpdated(oldRef, _comment);
if(_vmlShape != null) _vmlShape.getClientDataArray(0).setRowArray(0, new BigInteger(String.valueOf(row)));
}
代码示例来源:origin: org.openl.rules/org.openl.lib.poi.dev
/**
* Set the column of the cell that contains the comment
*
* @param col the 0-based column of the cell that contains the comment
*/
public void setColumn(int col) {
String oldRef = _comment.getRef();
CellReference ref = new CellReference(getRow(), col);
_comment.setRef(ref.formatAsString());
_comments.referenceUpdated(oldRef, _comment);
if(_vmlShape != null) {
_vmlShape.getClientDataArray(0).setColumnArray(
new BigInteger[] { new BigInteger(String.valueOf(col)) }
);
// There is a very odd xmlbeans bug when changing the column
// arrays which can lead to corrupt pointer
// This call seems to fix them again... See bug #50795
_vmlShape.getClientDataList().toString();
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
int row1 = o1.getRow();
int row2 = o2.getRow();
return o1.hashCode() - o2.hashCode();
XSSFComment xssfComment = new XSSFComment(sheetComments, comment,
vml == null ? null : vml.findCommentShape(rownum, ref.getCol()));
entry.getKey().setRow(entry.getValue());
代码示例来源:origin: org.apache.poi/poi-ooxml
/**
* Returns all cell comments on this sheet.
* @return A map of each Comment in this sheet, keyed on the cell address where
* the comment is located.
* @deprecated use <code>getCellAddresses</code> instead
*/
@Removal(version = "4.2")
@Deprecated
public Map<CellAddress, XSSFComment> getCellComments() {
prepareCTCommentCache();
final TreeMap<CellAddress, XSSFComment> map = new TreeMap<>();
for (final Entry<CellAddress, CTComment> e : commentRefs.entrySet()) {
map.put(e.getKey(), new XSSFComment(this, e.getValue(), null));
}
return map;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
@Override
public int hashCode() {
return ((getRow()*17) + getColumn())*31;
}
代码示例来源:origin: jbaliuka/x4j-analytic
public XLSXCellNode(XSSFSheet sheet,XSSFCell cell,int index,XLSXExpression expression) {
super(sheet,cell,expression);
assert cell != null : "null cell" ;
if(cell.getCTCell().isSetF()){
formulaStringValue = cell.getCTCell().getF().getStringValue();
}
colRef = CellReference.convertNumToColString(index);
int rowRef = getCell().getRowIndex() + 1;
absoluteRef = colRef + rowRef;
if(cell.getCTCell().isSetS()){
s = cell.getCTCell().getS();
}
workbookPr = getSheet().getWorkbook().getCTWorkbook().getWorkbookPr();
comment = cell.getCellComment();
if(comment != null){
commnetExpr = CellExpressionParser.parseExpression(comment.getString().getString());
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
/**
* Set the row of the cell that contains the comment
*
* If changing both row and column, use {@link #setAddress}.
*
* @param row the 0-based row of the cell that contains the comment
*/
@Override
public void setRow(int row) {
setAddress(row, getColumn());
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.poi
/**
* Set the column of the cell that contains the comment
*
* If changing both row and column, use {@link #setAddress}.
*
* @param col the 0-based column of the cell that contains the comment
*/
@Override
public void setColumn(int col) {
setAddress(getRow(), col);
}
内容来源于网络,如有侵权,请联系作者删除!