Excel报告在C#中设置页面设​​置选项

时间:2020-12-27 22:40:22

I am using the following approach to create a dynamic Excel Report from HTML in my ASP.NET Application.

我使用以下方法在我的ASP.NET应用程序中从HTML创建动态Excel报表。

While creating the excel report, I want to set the Page Setup options such that the report fits into one page.

在创建Excel报表时,我想设置页面设​​置选项,使报表适合一个页面。

This is the approach I'm using to create the excel report... Please tell me how to fit this report to one page or to zoom in the report?

这是我用来创建Excel报告的方法...请告诉我如何将此报告放到一个页面或放大报告?

    string sContentType = "application/vnd.excel";
    string sFileName = "Detail Qutation.xls";
    Hashtable oData = new Hashtable();
    oData.Add("Content-Disposition", "attachment;filename=" + sFileName);           
    oData.Add("Charset", "");
    oData.Add("ContentType", sContentType);
    oData.Add("Content", sTable.ToString());
    oData.Add("IsBinaryContent", false);
    this.StoreObject("Document", oData);

1 个解决方案

#1


You might need to render using htmltextwriter as explained in

您可能需要使用htmltextwriter进行渲染,如中所述

http://forums.asp.net/p/1063850/1538066.aspx#1538066

and take the concept to get a solution.

并采取这个概念来获得解决方案。

#1


You might need to render using htmltextwriter as explained in

您可能需要使用htmltextwriter进行渲染,如中所述

http://forums.asp.net/p/1063850/1538066.aspx#1538066

and take the concept to get a solution.

并采取这个概念来获得解决方案。