Quantcast
Channel: npoi Discussions Rss Feed
Viewing all articles
Browse latest Browse all 637

New Post: Error reading .xlsm file with pivotTable

$
0
0
I have a template .xlsm file with two pivotTable in sheet2 and sheet3. If I read the file with NPOI, and save it to another path(without any changes), those pivotTable cannot be reopened again. To be specific, when I opened the new file, it will report crash and begin auto fixing. After the fixing, only some string left in sheet2 and sheet3, with no table left.

The code is here:
        FileStream readFile = new FileStream(templatePath, FileMode.Open, FileAccess.Read);

        XSSFWorkbook xssfworkbook = new XSSFWorkbook(readFile);

        readFile.Close();

        FileStream writeFile = new FileStream(outputPath, FileMode.Create, FileAccess.Write);

        xssfworkbook.Write(writeFile);

        writeFile.Close();
You can see I didn't make any changes to the template, but those pivotTable will still be disappeared in the new file.

Viewing all articles
Browse latest Browse all 637

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>