t5750 / poi Goto Github PK
View Code? Open in Web Editor NEW:sunny: Read and Write Excel file using Java and Apache POI
Home Page: https://poix.readthedocs.io
License: Apache License 2.0
:sunny: Read and Write Excel file using Java and Apache POI
Home Page: https://poix.readthedocs.io
License: Apache License 2.0
如题。一直转圈,没有异常
Hi, I set a cell alignment to the right & after setting the style to one cell I updated the alignment of a style to the left.
But I'm getting both the cell's alignment left in the output. Could you help me to fix this?
`CellStyle style1 = wb.createCellStyle();
style1.setAlignment(CellStyle.ALIGN_RIGHT);
HSSFCell hssfCell = row1.createCell(j);
String val = "200";
hssfCell.setCellValue(Integer.parseInt(val));
hssfCell.setCellStyle(style1);
HSSFCell hssfCell2 = row1.createCell(j);
val = "300";
hssfCell2.setCellValue(Integer.parseInt(val));
style1.setAlignment(CellStyle.ALIGN_LEFT);
hssfCell2.setCellStyle(style1);`
Thanks in advance
For some reason the parser recognizes lookup
but not xlookup
, even though xlookup
is supposed to be supported.
Code:
System.out.println("Parse \"LOOKUP(E76,$A$13:$A$41,$F$13:$F$41)\"");
for (Ptg ptg : FormulaParser.parse("LOOKUP(E76,$A$13:$A$41,$F$13:$F$41)", ewb, FormulaType.CELL, wb.getSheetIndex(sheet))) {
System.out.println(ptg);
}
System.out.println("Parse \"XLOOKUP(E76,$A$13:$A$41,$F$13:$F$41)\"");
for (Ptg ptg : FormulaParser.parse("XLOOKUP(E76,$A$13:$A$41,$F$13:$F$41)", ewb, FormulaType.CELL, wb.getSheetIndex(sheet))) {
System.out.println(ptg);
}
Output:
Parse "LOOKUP(E76,$A$13:$A$41,$F$13:$F$41)"
{ /* RefPtg */
"row": 75 /* 0x0000004b */
, "rowRelative": true
, "column": 4
, "colRelative": true
, "formatReference": "E76"
}
{ /* AreaPtg */
"firstRow": 12 /* 0x0000000c */
, "firstRowRelative": false
, "firstColumn": 0
, "firstColRelative": false
, "lastRow": 40 /* 0x00000028 */
, "lastRowRelative": false
, "lastColumn": 0
, "lastColRelative": false
, "formatReference": "$A$13:$A$41"
}
{ /* AreaPtg */
"firstRow": 12 /* 0x0000000c */
, "firstRowRelative": false
, "firstColumn": 5
, "firstColRelative": false
, "lastRow": 40 /* 0x00000028 */
, "lastRowRelative": false
, "lastColumn": 5
, "lastColRelative": false
, "formatReference": "$F$13:$F$41"
}
{ /* FuncVarPtg */
"functionIndex": 28 /* 0x001c */
, "functionName": "LOOKUP"
, "numberOfOperands": 3
, "externalFunction": false
, "defaultOperandClass": 32 /* 0x20 */
, "cetab": false
}
Parse "XLOOKUP(E76,$A$13:$A$41,$F$13:$F$41)"
{ /* NameXPxg */
"externalWorkbookNumber": -1 /* 0xffffffff */
, "sheetName": null
, "nameName": "XLOOKUP"
}
{ /* RefPtg */
"row": 75 /* 0x0000004b */
, "rowRelative": true
, "column": 4
, "colRelative": true
, "formatReference": "E76"
}
{ /* AreaPtg */
"firstRow": 12 /* 0x0000000c */
, "firstRowRelative": false
, "firstColumn": 0
, "firstColRelative": false
, "lastRow": 40 /* 0x00000028 */
, "lastRowRelative": false
, "lastColumn": 0
, "lastColRelative": false
, "formatReference": "$A$13:$A$41"
}
{ /* AreaPtg */
"firstRow": 12 /* 0x0000000c */
, "firstRowRelative": false
, "firstColumn": 5
, "firstColRelative": false
, "lastRow": 40 /* 0x00000028 */
, "lastRowRelative": false
, "lastColumn": 5
, "lastColRelative": false
, "formatReference": "$F$13:$F$41"
}
{ /* FuncVarPtg */
"functionIndex": 255 /* 0x00ff */
, "functionName": "#external#"
, "numberOfOperands": 4
, "externalFunction": true
, "defaultOperandClass": 32 /* 0x20 */
, "cetab": false
}
有时会出现这行代码构建的TreeMap<Integer, CTRPrElt> formats = this.getFormatMap(this.st)的最大值与原text的长度不符合,报错:
java.lang.IllegalArgumentException: Text length was 22 but the last format index was 28
org.apache.poi.xssf.usermodel.XSSFRichTextString.buildCTRst(XSSFRichTextString.java:576) ~[poi-ooxml-3.17.jar:3.17]
org.apache.poi.xssf.usermodel.XSSFRichTextString.applyFont(XSSFRichTextString.java:156) ~[poi-ooxml-3.17.jar:3.17]
org.apache.poi.xssf.usermodel.XSSFRichTextString.applyFont(XSSFRichTextString.java:166) ~[poi-ooxml-3.17.jar:3.17]
excel poi 文件中文名称乱码
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.