Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The program is looping when I use existingHeadingRows #80

Open
tuandomvn opened this issue Feb 21, 2024 · 0 comments
Open

The program is looping when I use existingHeadingRows #80

tuandomvn opened this issue Feb 21, 2024 · 0 comments

Comments

@tuandomvn
Copy link

tuandomvn commented Feb 21, 2024

I am trying to use your nuget and its really fast. However I have 1 issue when trying to maintain the header in exel template so I put value to existingHeadingRows
The below code that I am using

using (FastExcel.FastExcel fastExcel = new FastExcel.FastExcel(new FileInfo("myworkbook.xlsx"), new FileInfo("Output.xlsx")))
{
    var table = new DataTable();
    table.Columns.Add("Product", typeof(string));
    table.Columns.Add("Variety1", typeof(decimal));
    table.Columns.Add("Variety2", typeof(decimal));
    table.Columns.Add("Variety3", typeof(decimal));
    table.Columns.Add("Variety4", typeof(decimal));

    for (int columnNumber = 1; columnNumber < 13; columnNumber++)
    {
        table.Rows.Add("Product 1", 10, 12, 14, 45);
    }

    worksheet.PopulateRowsFromDataTable(table, 5);

    fastExcel.Write(worksheet, "MySheet", 5);
}

I also attach my sample code
ConsoleApp2_FastExel.zip

Can you please have a look? Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant