metadataconsulting / spreadsheet-builder Goto Github PK
View Code? Open in Web Editor NEWSpreadsheet Builder
License: Apache License 2.0
Spreadsheet Builder
License: Apache License 2.0
it will be nice to be able to define formula before the name is assigned to the cell
there is a way how to test tab colors. see here http://stackoverflow.com/questions/2093777/how-to-change-the-tab-color-of-a-worksheet-with-apache-poi
Would be nice if it were possible to insert pictures (png, gif, bmp, etc) into cells.
Apache POI has a method createFreezePane that allows to freeze rows/columns in a sheet. Exposing this feature would make a useful enhancement to the Spreadsheet Builder (which is great as it is - but even good things can be improved).
test code:
sheet("many rows"){
20000.times{
row {
cell {
value '1'
style 'h1'
}
cell {
value '2'
style 'h2'
}
cell {
value '3'
style 'h1'
}
cell {
value '4'
style 'h2'
}
}
}
}
error:
Expected no exception to be thrown, but got 'java.lang.IllegalStateException'
at spock.lang.Specification.noExceptionThrown(Specification.java:118)
at org.modelcatalogue.builder.spreadsheet.poi.PoiExcelBuilderSpec.create sample spreadsheet(PoiExcelBuilderSpec.groovy:389)
Caused by: java.lang.IllegalStateException: The maximum number of Cell Styles was exceeded. You can define up to 64000 style in a .xlsx Workbook
at org.apache.poi.xssf.model.StylesTable.createCellStyle(StylesTable.java:567)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.createCellStyle(XSSFWorkbook.java:659)
at org.apache.poi.xssf.usermodel.XSSFWorkbook.createCellStyle(XSSFWorkbook.java:108)
at org.modelcatalogue.builder.spreadsheet.poi.PoiCellStyle.<init>(PoiCellStyle.groovy:37)
at org.modelcatalogue.builder.spreadsheet.poi.PoiCell.style(PoiCell.groovy:86)
at org.modelcatalogue.builder.spreadsheet.poi.PoiRow.cell(PoiRow.groovy:55)
at org.modelcatalogue.builder.spreadsheet.poi.PoiExcelBuilderSpec$__spock_feature_0_0_closure1$_closure2$_closure15.closure100$_closure101(PoiExcelBuilderSpec.groovy:371)
at groovy.lang.Closure.call(Closure.java:426)
at groovy.lang.Closure.call(Closure.java:442)
at org.modelcatalogue.builder.spreadsheet.poi.PoiSheet.row(PoiSheet.groovy:34)
at org.modelcatalogue.builder.spreadsheet.poi.PoiExcelBuilderSpec$__spock_feature_0_0_closure1$_closure2.closure15$_closure100(PoiExcelBuilderSpec.groovy:362)
at groovy.lang.Closure.call(Closure.java:426)
at groovy.lang.Closure.call(Closure.java:442)
at org.modelcatalogue.builder.spreadsheet.poi.PoiExcelBuilderSpec$__spock_feature_0_0_closure1.closure2$_closure15(PoiExcelBuilderSpec.groovy:361)
at groovy.lang.Closure.call(Closure.java:426)
at groovy.lang.Closure.call(Closure.java:442)
at org.modelcatalogue.builder.spreadsheet.poi.PoiWorkbook.sheet(PoiWorkbook.groovy:29)
at org.modelcatalogue.builder.spreadsheet.poi.PoiExcelBuilderSpec.$spock_feature_0_0_closure1$_closure2(PoiExcelBuilderSpec.groovy:360)
at groovy.lang.Closure.call(Closure.java:426)
at groovy.lang.Closure.call(Closure.java:442)
at org.modelcatalogue.builder.spreadsheet.poi.PoiSpreadsheetBuilder.build(PoiSpreadsheetBuilder.groovy:15)
at org.modelcatalogue.builder.spreadsheet.poi.PoiExcelBuilderSpec.create sample spreadsheet_closure1(PoiExcelBuilderSpec.groovy:23)
at groovy.lang.Closure.call(Closure.java:426)
at groovy.lang.Closure.call(Closure.java:442)
at org.modelcatalogue.builder.spreadsheet.poi.PoiExcelBuilderSpec.create sample spreadsheet(PoiExcelBuilderSpec.groovy:22)
In reusing styles demo ,I can't set the font name.The default font name is Calibri,but I won't use it.
it would be great to be able to define styles which are not yet implemented. there are at least two approaches
?
- title?
would use the style title
if present but fail silently if not presentwhen cell is created using cell()
call the style declared on row level are not applied.
There is an ability to hide/unhide sheets in Excel. It would be great to have it in the API, if POI allowed.
UPD: POI methods
It might be difficult to keep in track with the columns while you're dumping the data into rows. for this use case it might be good to have counterpart to DataRow
which will help you to fill the rows according to header values.
So you can't build project with it as usual with maven
or gradle
:
./gradlew jar
...
> Task :compileJava FAILED
/home/pasha/temp/pdfIndex/IndexBookHighlight/src/main/java/Tt.java:5: error: cannot access SpreadsheetCriteriaFactory
import static org.modelcatalogue.spreadsheet.query.poi.PoiSpreadsheetCriteria.FACTORY;
^
class file for org.modelcatalogue.spreadsheet.query.api.SpreadsheetCriteriaFactory not found
cell {
text "Normal and "
text "Styled", {
bold
}
}
should be SpreadsheetCriteria
instead of SpreadsheetQuery
in reading spreadsheets section
The named style is not work.
Apache POI has a method to set a print area for a sheet. Exposing this feature in the Spreadsheet Builder would be most helpful.
Hello, I gave a try to the SpreadSheet builder and I find it very interesting.
I stumbled upon a problem with the following line of code in the example:
SpreadsheetQuery query = PoiSpreadsheetQuery.FACTORY.forFile(file)
The source for these two classes seems to be missing (I did a grep over all the source to make sure it was not defined embedded within another class).
The only references are in the Asciidoc documentation.
I managed to make it working by using the following code as a replacement:
SpreadsheetCriteria ssc = PoiSpreadsheetCriteria.FACTORY.forFile(file)
It may also be an issue of the example not being updated to the latest version of the API?
I cannot seem to find the 1.0RC2 release on Maven Central. I'm looking for it using the following coordinates org.modelcatalogue:spreadsheet-builder-poi:1.0.RC2
Am I missing something?
if there is already a comment in the cell, the comment should be appended instead of trying to create another one with the failure mentioned in the header
would be great to be able to work in column mode instead of row
sheet {
column {
cell 'Hello'
}
column ('H') {
cell 'World'
}
}
we should be able to set the width in cm
and inches
in PoiCellDefinition
, there is:
@Override
void value(Object value) {
if (!value) {
xssfCell.setCellType(Cell.CELL_TYPE_BLANK)
return
}
....
}
Looks like 0
falls into the first check.
I think, the correct way is to compare value
to null
explicitly.
code:
builder.build(out) {
style "body", {
font {
color red
}
border {
style thin
color black
}
}
sheet("merge rows") {
row {
style "body"
cell {
value 1
colspan(2)
}
cell {
value 2
}
}
row {
style "body"
cell {
value 1
colspan(2)
}
cell {
value 2
}
}
}
}
The B colum border is lost
First, thanks a lot for this awesome library for handling speadsheets. :)
The following warning message appeared after upgrade to spreadsheet-builder-poi 0.3.1
Oct 21, 2016 2:35:47 PM org.codehaus.groovy.runtime.m12n.MetaInfExtensionModule newModule
WARNING: Module [spreadsheet-builder-api] - Unable to load extension class
[org.modelcatalogue.spreadsheet.builder.api.extensions.SpreadsheetBuilderModule]
Switch back to 0.3.0, it disappeared.
OS: Ubuntu Linux 64bit
Java: OpenJDK 1.8.0 u102
Groovy: 2.4.7
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.