I have created an excel package using EPPlus, however instead of downloading as an excel file, I want to see the contents of that package in an asp.net page.
The easiest way might be to display as a PDF, in which case you'd need a converter. Someone else had that problem here.
Otherwise, since the fields aren't symmetric, you would have to create a custom aspx template deigned to pick up the fields and display them in the right areas, or maybe create a table grid and fill the empty excel cells with empty values in the generated table.
Related
I need to open a html table to a new tab as a pdf to be ready for printing. Problem I am having is exporting the html table due to the css tied to it. Many of the elements are colored differently depending on the row, cell, etc. How can I export the table to a pdf with all the css intact? I am using angularjs btw
In another part of the page, I had ui-grids created using angularjs and I was able to exporter them using pdf make.
Without your code, tough to know with complete certainty that this would work for you, but I have used fpdf to generate billing statements for customers. The output can be colored based on values of variables passed to it using the "SetTextColor" function. The call to fpdf is done usually as an ajax request on a button push, so you should be able to capture all the rows and columns of your table, and use the same type of logic to adjust the colors within your fpdf class.
For more information about fpdf: http://www.fpdf.org/
I need a function to convert any HTML table to a excel file!
I like to add a button to my page and once that button is clicked I pass a complete HTML table in to such a function that will generate an excel file and past the html table into the file with the same layout and design!
I appreciate any help with this request.
I am using c# and asp.net
This is a nasty trick, but it works in recent version of excel.
You just save the html table as a normal html file, then just rename it to xls. If your application is a web application use response.setHeader("Content-Disposition", "attachment; filename=order.xls").
Recent version of excel support Microsoft Office XML Formats, so if the previous solution doesn't work, you may want to try to generate the xml from the html table.
See XML Spreadsheet Reference.
What I do, is to generate the xml from excel in the xml format, then hack into it. You can implement also advanced features like automatic filters, and cool layouts. I used a template engine to generate the xml (Freemarker, it's Java stuff, but I'm sure there are template engines also for .NET)
I am retrieving an XML document from a web service (UPS actually), and I can pull the information I need from the XML, but I can't get the XML to display in the XML format. I can get it to display in a label and literal, but its all ran together. The nodes aren't displaying. The nodes display in a text box control, but it still runs together (no brks)
Any idea how to take the XML document that i get from the service and display it just like it would if you open up an XML doc in IE?
Thanks
BTW... i have search all day for this and the only thing i could find is if i was displaying a static file, which i'm not. I also tried doing the stringbuilder/stringwriter, but no luck. I'm still pretty new at this stuff so i could be missing something.
HELP... PLEASE!
Try encompassing the XML in the
<pre>... your xml</pre>
tags.
I know that there a quite a few techniques to export grid view to excel. Below are a few:-
HTML Rendering to HTMLTextWriter and Sending the Response Content Type as Excel.
Using XML technique and generating the XML String as Excel Sheets.
Using Office Interop dlls to create an object for excel document and work on it accordingly.
Now the requirement is, I have multiple Grid Views on a aspx page and these Grid views are loaded from different data sources. I have Export button, which have to export each grid view to separate work-sheet of a single excel file.
This can be done using second and third techniques mentioned above. Want to know the possibility of using the first technique i.e. using HTMLTextWriter
You can do using Open XML
http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=5124
http://openxmldeveloper.org/
I'm developing a CMS aplication in ASP .Net using WebForms and I'm looking for a way to create new PDF files based on a template.
This feature will be used to generate contracts where some placeholders will be replaced with the customer data.
What's the best approach to do that?
Edited: The templates will be static, the main content will never change from customer to customer, only some text in the beginning that will contain the placeholders to recive the customer data. The catch is that I must allow the owner of the application to upload new templates in PDF, with the predetermined placeholders in it to allow the replacement to occur.
I can think of two approaches depending on what type of template you are looking at:
1) Static Template - Say the template does not change with the data (Ex.some standard compliance form etc)
You can try something like iTextSharp, where you have your templates defined in your .net code, and you just "plug in" the relevant data and render the PDF via iTextSharp.
2) Dynamic Templates - Say your template isn't standard and is user customizable. In this case, I'd say go for HTML for designing and "print" the for to PDF. There are many components available.
You may also want to try out components like crystal reports.
I'd go with static HTML templates containing substitution tokens e.g. {FullName} which you can then replace with your data. Once you have created an HTML file like this, say in a StringBuilder, you can use PrinceXML or ABCPdf.net (www.websupergoo.com) to transform your HTML into a PDF.
I hope I am understaning this correctly but wouldn't using standard PDF Form Fields give you the functionality and features you require. Load the PDF template into Adobe Acrobat Full or Foxit Phantom and define standard PDF Form Fields on top of the PDF. Each field has a name, position, font etc.
Then just use a standard PDF library to fill in the PDF form fields and 'flatten' the form fields if that is required.
This solution allows the customer to design new PDF layouts and so long as they define form fields with names that match up then you will be able to drop in the replacement form with a simple file copy.
The iText or iTextSharp library should be able to do all of this quite easily. If not them there are many PDF libraries out there that can.