I have created an excel file using EPPlus library, is there a short way to show it in the webpage without writing lots of codes ?
One solution would be to embed your report as a PDF or as a large PNG/Jpeg.
Another solution would be to embed a PDF using pdf.js
http://mozilla.github.com/pdf.js/
This allows javascript to render a PDF without using any additional plugins, etc. (although it does need a HTML 5 browser)
http://mozilla.github.com/pdf.js/web/viewer.html
Related
Working on a task that displaying or previewing an excel file, which generated by EPPlus, on web page (.aspx).
Now, my problem is all the source point to the keywords: excel web app, excel web service, sharepoint or Excel online, but when i dug into those keywords i lose myself. Most of the information are about how to do the task inside the excel, such as save as html, publish to sharepoint etc. And the rest of the information are delivered by brain-unfriendly example or language.
So I am wondering can someone give me a walk-through method about publishing or displaying or previewing or editing an Excel file on web page(.aspx) by C# language and .NET framework.
Thanks.
You can't natively modify Excel files in web browsers. Browsers can support some files such as Java Applets or Adobe Flash, but those requires plugins, and they don't exist for Excel files.
Instead, you should create an HTML representation of the Excel file, and allow the user to then manipulate the HTML representation. When they're done, generate an Excel file based on their changes.
Alternatively, allow the user to download the Excel file and make their changes, and allow them to publish the changes back to the server by uploading the file.
I am working on a ASP .NET project where the requirement is to download a text area content as a file like .doc, .pdf and .txt.
I know we can download the plain text of text area as .txt using java script but the thing I want to know is,
How can I achieve the same for .doc and .pdf
is there any java script/jquery way to achieve this if not then what is the right way to do this in native C#.
examples or links would be great.
PDF and Word Documents are complex file types. If you want to generate these files client side, you'll need a javascript library that can generate files in these formats. I don't think these exist (as this is an uncommon request), but you can google it.
If I would be faced with a problem like this, I would post the value of the textbox back to the server and generate the files on the server. This SO post discusses how to create a pdf file in C#: How to generate a PDF?
Once you have created the file server side, you can then send it back to the client.
Its a general scenario when we provide an option of attaching a file (MS .doc) to end user. This file is stored in DB as binary. When user try to access this attachment next time, we allow them to download it. Now, here I want to give a feature to user where he should be able to open this doc file on click, edit it and save it without downloading.
.doc is a binary format and not easy to work with - a library such as Aspose, as mentioned by Christian, is definitely the way to go.
However, if .DOCX is acceptable (and that's Office 2007 and higher), then you can achieve what you want in three steps:
Convert .docx to HTML
Convert Word to HTML then render HTML on webpage
Display the HTML using any rich text control of your choice
What is the best rich textarea editor for jQuery?
Finally, convert HTML back to .docx:
Convert Html to Docx in c#
You would have to "reinvent" Microsoft Office Online (look into your skydrive account). I am unsure if there are any "out of the box" libraries for that, but you could build a simple editing app by leveraging Aspose word (or some other library). But that would be far from simple.
Link to aspose: http://www.aspose.com/.net/word-component.aspx
Word will only open files that are locally stored. What you are looking for is something similar to editing items that SharePoint provides using the WebDAV interface.
You may be able to use this approach to support your requirement. You should be cautious about the security aspects of the solution unless you have fully authenticated access to the shared folder on the server.
I am not sure if a standalone MS Word Document editor exists. However, this can be done with using a combination of rich text formatting / converting tool (for example, the DevExpress ASPxHtmlEditor + Document Server):
Load binary data from a DB;
Import loaded data (MS Word content) as HTML content into the ASPxHtmlEditor;
Edit imported data via the WYSIWYG ASPxHtmlEditor;
Convert the edited HTML back to MS Word content;
Save the converted / edited MS Word content back to the DB.
I believe, it is possible to do something like this if you have such products (free or commercial analogs) in your project.
i'm trying to create a PDF by using database in ASP C#. PDF will include just titles and contents so what do i have to use to do such a thing and can you provide me a some examples? Thank you.
You can use iTextSharp which is an open source pdf library.
You can find a documentation format here.
Book reference : iText in Action
Generate PDF using iTextSharp can be a good startup on how to use iTextSharp to generate PDF using asp.net.
I would go for html -> pdf conversion. You can use a free command line utility wkhtmltopdf for it.
If you want something more complex like prepare multiple templates or store history of pdf outputs. Look at free reporting server jsreport. ( I am the author)
I'm using C# 2005 as a programming platform. I want to have a program reading pdf file and output the content in picturebox properties. Can anyone help me on how could i do this?
You can't render PDF in a PictureBox. Picture boxes are for displaying pictures. So if you want to render a PDF file inside a picture box you will have to first convert it to, well, a picture. There are some commercial products such as ABC PDF that would allow you to do this conversion.
Another possibility is to use the Adobe Reader ActiveX control which you could host in your WinForms application and directly show the PDF file as is.
There are some opensource libraries out there. Choose one of the below:
sharpPDF: http://sharppdf.sourceforge.net/
PDFjet: http://pdfjet.com/os/edition.html
PDF Clown: http://sourceforge.net/projects/clown/
You can get the content of the PDF file using on of these libraries. About showing it on your form etc., I'd suggest examining the samples of these libraries.