GithubHelp home page GithubHelp logo

Comments (10)

b0bi79 avatar b0bi79 commented on May 8, 2024

I do not know about such limitations in the number of columns. Can you send a test in which I can reproduce it?

from closedxml.report.

Fox2726 avatar Fox2726 commented on May 8, 2024

@b0bi79 i found it. the same issue as below. And ever the column did not tag to
"row","column","page" also could not be null or empty.

In the data for which there is a grouping (tags <>, <>, <>) there should not be null or empty lines. Blank lines must be replaced by at least a space. The used version of ClosedXML (v0.92) did not correctly process such data. I think that in the new version of ClosedXML this problem should be fixed.

from closedxml.report.

b0bi79 avatar b0bi79 commented on May 8, 2024

Thanks, I will check it on the new version

from closedxml.report.

mlivingstonNE avatar mlivingstonNE commented on May 8, 2024

I have a similar issue. I have a table which varies in number of rows but is generally 35,000 to 40,000. The number of columns is static at 10. When creating a pivot table, the maximum number of rows that will correctly translate to a pivot table is 32,895 (that was fun determining). Therefore, I not only can I not create a complete pivot table, I also cannot use LastRowUsed to define it.

I'm using v0.94.

from closedxml.report.

b0bi79 avatar b0bi79 commented on May 8, 2024

If this is not a limitation of MS Excel, then this may be a limitation of ClosedXML. Can you provide the problem result file?

from closedxml.report.

mlivingstonNE avatar mlivingstonNE commented on May 8, 2024

Certainly.
Test2.xlsx

from closedxml.report.

b0bi79 avatar b0bi79 commented on May 8, 2024

@mlivingstonNE please also attach the template. Thanks.

from closedxml.report.

mlivingstonNE avatar mlivingstonNE commented on May 8, 2024

There is no template. But here is the code from the application:

static void Main(string[] args)
{
String fileName = "DeliveryCompliace " + DateTime.Today.ToString("MMddyyyy") + ".xlsx";
String runTime = DateTime.Now.ToString("MM/dd/yyyy HH:mm");
String reportDate = DateTime.Today.ToLongDateString();

        // Create Workbook
        XLWorkbook wb = new XLWorkbook();
        // Create Worksheet
        IXLWorksheet ws = wb.Worksheets.Add("Data");

        
        // Fill table from stored procedure
        SqlConnection sqlConnection = new SqlConnection(Properties.Settings.Default.conString);
        SqlCommand sqlCommand = new SqlCommand("dbo.cex_DScanCompData", sqlConnection);
        sqlCommand.CommandType = CommandType.StoredProcedure;
        sqlCommand.Parameters.Add("@dDate", SqlDbType.DateTime).Value = reportDate;
        SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand);
        DataTable dataTable = new DataTable();
        sqlDataAdapter.Fill(dataTable);

        // Insert Datatable data
        IXLTable table = ws.Cell(1, 1).InsertTable(dataTable, "Data", true);

        // Fix OrderTrackingID format in ws
        ws.Column(5).CellsUsed().Style.NumberFormat.Format = "#.000000";
        // Adjust column widths in ws
        ws.Columns().AdjustToContents();

        // Pivot Table
        // Add new worksheet
        IXLWorksheet ps = wb.Worksheets.Add("Report");

        // Create pivot table
        var totalRows = ws.LastRowUsed().RowNumber() - 5;
        var totalColumns = ws.LastColumnUsed().ColumnNumber();
        IXLPivotTable pt = ps.PivotTables.Add("PivotTable", ps.Cell(3, 1), ws.Range(1,1,totalRows,totalColumns)); // Max rows 32,895!!

        pt.RowLabels.Add("TerminalName").SetCollapsed();
        pt.RowLabels.Add("Driver").SetCollapsed();
        pt.RowLabels.Add("ConsCompany", "Client").SetCollapsed();

        pt.Values.Add("PkgCount").SetSummaryFormula(XLPivotSummary.Sum);
        pt.Values.Add("DScan").SetSummaryFormula(XLPivotSummary.Sum);
        pt.Values.Add("MScan").SetSummaryFormula(XLPivotSummary.Sum);
        pt.Values.Add("NScan").SetSummaryFormula(XLPivotSummary.Sum);

        //For testing purposes
        IXLWorksheet ws3 = wb.Worksheets.Add("Test");
        ws3.Cell("A1").Value = totalRows;
        ws3.Cell("A2").Value = totalColumns;

        // Save workbook
        wb.SaveAs(@"C:\Users\CEsolutions\Documents\Test2.xlsx");
    }

from closedxml.report.

b0bi79 avatar b0bi79 commented on May 8, 2024

@igitur I think it need to create an issue in ClosedXML?

from closedxml.report.

mlivingstonNE avatar mlivingstonNE commented on May 8, 2024

I will do that.

from closedxml.report.

Related Issues (20)

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.