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.
Related
I want to save my view result in web to excel and or PDF. I must show dialog save to make path and choose the file's extension to make file. I use asp.net, Could you help me how to do this?
for pdf use this library wkhtmltopdf
for excel use Microsoft.Office.Interop.Excel;
if you problem with this library ask me.
I have been looking for a solution all over the last days and I found that this library EPPlus allows retrieving in the same time formatting besides the actual data, plus charts, if needed, from Excel files which is what I am aiming at the moment.
Could you please explain to me step by step how to read a Range of cells from an Excel (like A1:P34) file that resides at a certain path, via ASP.NET/C#?
PATH would be something like //ServerName/Folder1/Folder2/Folder3/ExcelFileName.xlsx
I looked over the web, but there is not explicit documentation for my level of C# expertise on this. I tried several examples but none displayed the Excel Range into the webpage. (e.g this one.)
Note: the three examples I have tried all included an File Upload Control, I do not need such. I want to read the Excel file from a specified location over the local network.
EPPlus library is available here.
If you can recommend me any simpler resources to understand EPPlus on:
-reading from Excel
-writing from Excel
-reading charts from Excel
This EPPlus does seem wonderful in its functionality.
To read a file off the server take a look at this:
Open ExcelPackage Object with Excel application without saving it on local file path
Just need to set the var path part for your file.
To actually put the excel data on a web page, that is not so easy. See this:
Generating a HTML table from an Excel file using EPPlus?
Response to Comment:
Hosting an actual excel sheet in web page is temperamental at best but there are ways to do it (I haven't tried it personally). SharePoint is probably your best option if you have it available. If not, you would have to use an iFrame or some kind of office web component. Check this out:
how to display excel sheet in html page
I have a small wpf product which requires exporting data to excel with out excel installed on the client machine.How to achieve this in C#.After exporting, this excel can be opened by Open office. All I wanted is to save excel file to the client hard disk. Even excel is not installed he should be able to save the file,he may not be read it without excel but should be able to save. I dont want to any 3rd party or some other open xmls.
Recently I downloaded a product which is able to export to excel without excel installed and able to open it with open office.
When i checked their binaries they contain office.dll ,Microsoft.Vbe.Interop.dll and Microsoft.Office.Interop.Excel.dll's only .I want to know how they are able to manage with these dlls.
I have already written code for this but its breaking when excel is not installed.
I have read many open xml and other stuff relating to this but not satisfied.
My requirement is too simple ,just exporting datatable data to excel,no reading back the data and no fancy oparations with excel.
Please give me suggestions and links will be appreciated.
Thanks in advance
Either work out with CSV format or you may like to use EPPlus library. See similar answer here
You can use CSV, XML, or ADO
How To Use ADO.NET to Retrieve and Modify Records in an Excel Workbook With Visual Basic .NET
xslt transformation can also to the job. i use it to export wpf datagrid data.
There is some code/werbparts on our site that display a lot of data in a grid on our site. In addition, they have another page with a few charts.
I need a way to create functionality to export this to excel so the user can click a button and save everything.
The chart will actually have to be built in excel, I can't just grab the picture from the website and display it.
Also, the data from the grid will have to be put into a spreadhseet. I am not as worried about this part.
I have exported to excel before, but it was just basically printing some data which was tab delimited with a certain doc type .
This actually will need to use different work sheets and use some excel functionality.
(I need a better answer than use excel services)
Thanks!
Use Epplus is a third party library for creating and manipulating excel files(xlsx)
Dunno about sharepoint, but the OpenXML SDK might be what you're after:-
http://msdn.microsoft.com/en-us/library/bb448854.aspx
I have a dataset that I have modified into an xml document and then used a xsl sheet to transform into an Excel xml format in order to allow the data to be opened programatically from my application. I have run into two problems with this:
Excel is not the default Windows application to open Excel files, therefore when Program.Start("xmlfilename.xml") is run, IE is opened and the XML file is not very readable.
If you rename the file to .xlsx, you receive a warning, "This is not an excel file, do you wish to continue". This is not ideal for customers.
Ideally, I would like Windows to open the file in Excel without modifying the default OS setting for opening Excel files. Office interop is a possibility, but seems like a little overkill for this application. Does anyone have any ideas to make this work?
The solution is in .Net/C#, but I am open to other possibilities to create a clean solution.
If you insert the following into the 2nd line of your XML it directs Windows to open with Excel
<?mso-application progid="Excel.Sheet"?>
Process.Start(#"C:\Program Files\Microsoft Office\Officexx\excel.exe", "yourfile.xml");
That being said, you will still get the message box. I suppose that you could use the Interop, but I am not sure how well it will work for you.
What if you save the file as an xlsx, the extension for XML-Excel?
As Sam mentioned, the xlsx file extension is probably a good route to go. However, there is more involved than just saving the xml file as xlsx. An xlsx is actually a zip file with a bunch of xml files inside folders. I found some good sample code here which seems to give some good explanations although I haven't personally given it a try.
Apologies in advance for plugging a third party library, and I know it's not free, but I use FlexCel Studio from TMS Software. If you're looking to do more than just dump data (formatting, dynamic cross-tabs, etc) it works very well. We generate hundreds of reports a week using it.
FlexCel accepts strongly-typed datasets, it can group data according to relationships, and the generated Excel file looks so much cleaner than what you can get from a Crystal Reports excel export. I've done the crystal reports thing, and the OLE automation thing. FlexCel is a steal at $125 EU.
Hope this helps.
OpenXML in MSDN - http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.workbooks.openxml(v=office.11).aspx
using Excel = Microsoft.Office.Interop.Excel;
string workbookPath= #"C:\temp\Results_2013Apr02_110133_6692.xml";
this.lblResultFile.Text = string.Format(#" File:{0}",workbookPath);
if (File.Exists(workbookPath))
{
Excel.Application excelApp = new Excel.Application();
excelApp.Visible = true;
Excel.Workbook excelWorkbook = excelApp.Workbooks.OpenXML(workbookPath, Type.Missing, Excel.XlXmlLoadOption.xlXmlLoadPromptUser);
}
else
{
MessageBox.Show(String.Format("File:{0} does not exists", workbookPath));
}