GithubHelp home page GithubHelp logo

metadataconsulting / spreadsheet-builder Goto Github PK

View Code? Open in Web Editor NEW
47.0 47.0 21.0 2.04 MB

Spreadsheet Builder

License: Apache License 2.0

Java 47.04% Groovy 52.96%
builder builder-pattern builders excel exceldatareader excelgenerator excelparser excelreader excelwriter groovy microsoft spreadsheet spreadsheet-manipulations

spreadsheet-builder's People

Contributors

atapin avatar musketyr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spreadsheet-builder's Issues

Feature Request: Freeze rows/columns

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).

java.lang.IllegalStateException: The maximum number of Cell Styles was exceeded. You can define up to 64000 style in a .xlsx Workbook

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) 

set font name

In reusing styles demo ,I can't set the font name.The default font name is Calibri,but I won't use it.

optional named styles

it would be great to be able to define styles which are not yet implemented. there are at least two approaches

  1. never fail if the style is not found - this is error-prone to typos
  2. use special character to determine that the style is optional e.g. a question mark ? - title? would use the style title if present but fail silently if not present

Hide/unhide sheets

There is an ability to hide/unhide sheets in Excel. It would be great to have it in the API, if POI allowed.
image

UPD: POI methods

data mapper

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.

org.modelcatalogue.spreadsheet.query.poi.PoiSpreadsheetCriteria is not public

image
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

Feature Request: Print Area

Apache POI has a method to set a print area for a sheet. Exposing this feature in the Spreadsheet Builder would be most helpful.

SpreadsheetQuery object source missing?

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?

Not available in Maven Central

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?

column mode

would be great to be able to work in column mode instead of row

sheet {
    column {
        cell 'Hello'
    }
    column ('H') {
        cell 'World'
    }
}

Zero is displayed as blank cell

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.

How to set border when merging cells?

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

"Unable to load extension class" warning message with version 0.3.1

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.