C# EPPlus cannot Read Excel Spreadsheet - c#

I am trying to read the data in an .xlsx workbook.
EPPlus is successfully reading the Workbook without any errors. The problem is the Worksheets inside the workbook.
EPPlus seems to not read the worksheets. See screenshot below.
enter image description here
I opened the Workbook that I want to read and found out that all the Cell formats are in "Custom".
enter image description here
I tried to change the cell formats manually to "General" and EPPlus successfully reads the Worksheets.
enter image description here
The thing is that the excel file is coming from a downloaded file via Selenium UI automation. And since this is an automation, I do not want to have a manual intervention wherein I will have to change the cell format to "General" every time I run my auto scripts.
Do you guys know any workarounds / other libraries that can read excel worksheets with cell format as "Custom"?
BTW, I am using EPPlus version 4.5.3.3

Related

OpenXML- Copy Formula is not working after generating excel file

I have created one application using openXML features to export excel file. Initially I tried to fill excel cell by cell but, I faced performance issue because of bulk data. Then I copied datatable content into Excel table.
Now I am able to generate bulk data.
But after generating excel file I am not able apply copy formula.

C# Excel Interop - Cell text cut off on publishing

I have an Excel sheet where the text overflows the cell and into the next one, but when using the C# Excel Interop to publish this worksheet the text is simply cut off where the cell ends. If I publish the same worksheet from the Excel application the text is not cut.
I don't want to use wrapping as I'd like the resulting PDF to remain as close to the original Excel sheet as possible. How can I prevent the text from being cut off?

Loading spreadsheet template file doesn't retain form button

I am using SpreadsheetGear 2012 in my application to load, modify then save a new copy of a template workbook.
My code takes invoicing information from a database and formats it for the workbook. Then the user will print an invoice from the formatted information using a button on the workbook.
I use a template workbook with some formatting already provided to make my life easier. Included on the original template workbook is a button that runs a VBA macro in the spreadsheet. The VBA macro loads successfully but the button just disappears in the new workbook.
Some of the steps I have tried to rectify the issue: I've added a new button, changed the VBA macro code from a function to a sub, saved the template file as a macro-enabled spreadsheet (.xlsm) and saved the revised copy as a macro-enabled spreadsheet file.
Has anyone experienced this issue and do you have a solution?
If you are using the Open XML file formats (XLSX/XLSM), then this is a known limitation:
http://www.spreadsheetgear.com/support/help/spreadsheetgear.net.7.0/#SpreadsheetGear_2012_Limitations.html
In short, SpreadsheetGear 2012 does not support reading/writing Form Controls (like buttons), as well as Cell Comments, when working with the Open XML file formats. So your button is getting dropped when the file is initially read into SpreadsheetGear.
If you want to preserve these objects through SpreadsheetGear, you will need to use the XLS (FileFormat.Excel8) file format, which does support them.

How to write .jpeg into a specific cell in Excel

At the moment I get data from an Excel File and generate a QrCode out of it. Then I save it as a file (.jpeg). But I need to write the QrCode into a specific cell of the same Excel file.
Is there any way to do that?
Check out this answer: https://stackoverflow.com/a/31294015/1943849
You'll need to use ClosedXML fork https://closedxml.codeplex.com/SourceControl/network/forks/ajwhiteway/ClosedXMLImageSupport
Another option is to use OpenXML (low-level access to an excel file)

Generating Excel file with some number of sheets with a single template

i am generating an excel file with some number of sheets. I am using a template .xlt file which have one worksheet. Now I am able to generate the xl file with that template if there is only one worksheet in that excel file. But when I have to create more than one worksheet, I am unable to do that. Then the excel file do not use the template and instead use a blank worksheet. Can anyone point me to some reference where i can use the same template worksheet to create n number of worksheets in the same workbook.
SpreadsheetGear for .NET can do it.
See the "Worksheet with Chart to Multiple Worksheets with Charts" sample on our Excel Reporting Samples page for an example or download the free trial here to try it yourself.
Since the SpreadsheetGear API is very similar to the Excel API, you should be able to adapt the SpreadsheetGear code to work with Excel if you need to.
Disclaimer: I own SpreadsheetGear LLC

Categories

Resources