Loading spreadsheet template file doesn't retain form button - c#

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.

Related

C# EPPlus cannot Read Excel Spreadsheet

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

EPPlus Excel Exporting hides some tabs

I am using C# with EPPlus library.
The task is that I am opening an excel file, removing some sheets from it and saving it as a separate excel file.
The issue I am facing is that the excel sheet tabs at the bottom are moved out of view in the output file saved:
The activesheet is sheet 1, but the Sheet 1 tab is not visible on the excel file.
Is there any command using EPPlus which can amend this to look like:
Files saved by Excel can contain information about the width of the tab area. I am quite sure that EPPlus does not take care of this detail.
If you rename a .xlsx file to .zip and take the xl\workbook.xml file of it you will find a section that may contain an attribute 'tabRatio'. The attribute is present only if the width is adjusted manually. This attribute or the whole section may be deleted.
I did a test: I saved a file with too little space for the tabs and after deletion of the section the tab area looked fine again.
Maybe EPPlus generates the 'tabRatio' attribute but with useless values? Please check for it. If so, you might want to file a request for the developers to leave it out if it does not make sense.

Load existing excel file to edit in C#

I want to load an existing macro enabled Excel file to edit in C#. When I say existing Excel file, I mean that I want to set a template that the user must start with.
I am stuck at the first step, loading the Excel file. I managed to add the file to the solution, so it pops up in solution explorer but I don't know how to edit it in C#.

Is there any way to render Excel files in MVC4 C#?

i have a problem, i need to show a group of excel files in some views of an mvc4 project. The real problem is that the files are Excel PowerPivot and they can not be shown as images or pdf, it has to be Excel files.
Any ideas?
Thanks for the help...
If you can open the workbook in the Browser-based version of excel and see what you need to display, you can then use the Share->Embed feature of the Excel online app to generate HTML or JavaScript embed code.
If you need to have the end user manipulate the workbook to retrieve the necessary data from the PowerPivot table, then they'd most likely be better off downloading the workbook and going from that.
If they don't need to manipulate anything, look into if you can export the workbook to HTML in some fashion and embed that.
Hopefully that might put you down the right track.

How to embedded Excel file in ASP.Net page?

How to view excel file in ASP.Net page using c#?
I need to view excel file in asp.net form and access the all excel functionality in this excel sheet.
Note:
Excel sheet will open inside the form tag, it means open within a page, not open separate file.
Like: Update fields, Merge fields, Wrap cells, Format the fields and apply text color. whatever Excel sheet have functionality all will be work asp.net excel page.
Thanks in Advance.
You can upload this file to Google Doc and open it then chose File -> Publish to the Web -> Get html code and paste them.
Good luck.

Categories

Resources