GithubHelp home page GithubHelp logo

Read an excel file example about npoi HOT 3 CLOSED

dotnetcore avatar dotnetcore commented on May 29, 2024
Read an excel file example

from npoi.

Comments (3)

yang-xiaodong avatar yang-xiaodong commented on May 29, 2024 3

https://gist.github.com/yuleyule66/1e2c9bba2dba00337535a282f1a0c1eb

from npoi.

CharlesOkwuagwu avatar CharlesOkwuagwu commented on May 29, 2024

@yuleyule66 Please can you guide me in this scenario:

I have an existing excel file template.xlsx. I make a copy of this file, and I want to write to the copy with new data retaining the formatting of the template.xlsx file.

My attempt

https://gist.github.com/CharlesOkwuagwu/a9a34647070b87a86a170875a8468ced

The problem is that the code runs through successfully, but the new file never gets updated.

Thanks.

from npoi.

sherpya avatar sherpya commented on May 29, 2024

@CharlesOkwuagwu try this way:

XSSFWorkbook wb;

using (var fs = File.OpenRead(template))
{
    wb = new XSSFWorkbook(fs);
}

using (var fs = new FileStream(dest, FileMode.Create, FileAccess.Write))
{
    var ws = wb.GetSheetAt(0);
    ...
    ...
    wb.Write(fs);
}

from npoi.

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.