Word and Excel display on Web pages, file streams, virtual directories, file uploads

Source: Internet
Author: User

1. How to display Word and Excel on a Web page

A. You can use Aspose to convert Word and Excel to PDF and then open the PDF on a Web page, but the effect is not very good. For example, Excel multiple workbooks are not displayed in EXCE format, width size, bad control (?).

B. You can use Aspose to convert a document to HTML, but converting to HTML results in additional XML and CSS and picture files. Bad read in the file stream (the file is inside the local).

C. Other transformations can be used, such as http://www.cutepdf.com/(?), or read and re-converted with a file stream (not tried), or Word and Excel related components, such as in Word directly saved as an HTML suffix.

D. It is a good idea to convert the file to MHTML format, because MHTML is a single Web page file.

MHTML is called an aggregated HTML document Web document or a single file page applied to (Asscss,word,excel) is a single Web page file that saves all elements of the site (including sounds, pictures) to a single MHTML file.

2. How to upload files to the project, where to upload the files, how to save the uploaded files

A. Files can be uploaded to the ASP, but it is said that the project is increasingly affecting the efficiency of later operations, is not conducive to maintenance, not verified.

B. You can save the file in a data stream read to the database without practicing it (?).

B. Files can be uploaded to the server local disk, to facilitate the operation and management of files.

A. If uploading to the server read the converted Web page file no problem

B. Upload to the database to convert to a Web page file (not tried) (?)

C. upload into the local folder inside, as if Microsoft on the net above for security reasons do not support direct access to files outside the site (?) Other developments above are unclear,

1) You can use the Add virtual directory, that is, to add the virtual directory path on the server, the map to the absolute path directory is the path to the image you want to access, in the new upload folder in the VS development, only on the ISS after the release of the file, make changes to the original folder into a virtual path file, But still follow Server.MapPath (@ "~/new_ams/file/" + fileName) to get the path, (?) Concrete has not been practiced.

2) You can use the file stream to read local files, map paths, reference code http://www.cnblogs.com/insus/archive/2013/02/05/2892678.html,

But a little file stream seems to be able to read only a single file (?) and not read the HTML + external css+ image at the same time, so use the previous method to convert the file to the MHTML format

The file is uploaded to the project  if (type = = ". Doc" | | type = = ". docx")  {    Aspose.Words.Document doc = new Aspose.Words.Document (filep ATH);     Doc. Save (Savepath + ". Html ", Aspose.Words.SaveFormat.Mhtml);     url = @ "~/new_ams/file/" + FileName + ". html";   }     if (type = = ". xls" | | type = = ". xlsx")      {     Aspose.Cells.Workbook Workbook = new Aspose.Cells.Workbook (filePath); 
   workbook. Save (Savepath, Aspose.Cells.SaveFormat.Html);        url = "~/new_ams/hdsrc.ashx?file=" + Savepath + ". htm"; }

  

Word and Excel display on Web pages, file streams, virtual directories, file uploads

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.