当前位置: 首页>>代码示例>>C#>>正文


C# Callback.getWorkbookXLS方法代码示例

本文整理汇总了C#中Callback.getWorkbookXLS方法的典型用法代码示例。如果您正苦于以下问题:C# Callback.getWorkbookXLS方法的具体用法?C# Callback.getWorkbookXLS怎么用?C# Callback.getWorkbookXLS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Callback的用法示例。


在下文中一共展示了Callback.getWorkbookXLS方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Page_Load

    protected void Page_Load(object sender, EventArgs e)
    {
        #region variables
        string tType = string.Empty;
        string tFileName =string.Empty;
        string tSvg = string.Empty, tTitle = string.Empty, tSubtitle = string.Empty, tSource = string.Empty, tTableData = string.Empty, tKeywords = string.Empty;
        #endregion

        #region getting information from posted form
        if (Request.Form[Constants.XLSDownloadType.TypeText] != null)
        {
            tType = Request.Form[Constants.XLSDownloadType.TypeText].ToString();
        }
        if (Request.Form[Constants.XLSDownloadType.FilenameText] != null)
        {
            tFileName = Request.Form[Constants.XLSDownloadType.FilenameText].ToString();
        }
        if (string.IsNullOrEmpty(tFileName))
        {
            tFileName = Constants.XLSDownloadType.DefaultFilename;
        }
        if (!string.IsNullOrEmpty(Request.Form[Constants.XLSDownloadType.SvgText].ToString())) // Generate svg file on temp,location
        {
            tSvg = Request.Form[Constants.XLSDownloadType.SvgText].ToString();
        }
        if (Request.Form["title"] != null)
        {
            tTitle = Request.Form["title"].ToString();
        }
        if (Request.Form["subtitle"] != null)
        {
            tSubtitle = Request.Form["subtitle"].ToString();
        }
        if (Request.Form["source"] != null)
        {
            tSource = Request.Form["source"].ToString();
        }
        if (Request.Form["tabledata"] != null)
        {
            tTableData = Request.Form["tabledata"].ToString();
        }
        if (Request.Form["keywords"] != null)
        {
            tKeywords = Request.Form["keywords"].ToString();
        }
        #endregion
        string tExt = Constants.XLSDownloadType.XlsExtention;
        MemoryStream tData = new MemoryStream();
        Callback callbackObj = new Callback(this.Page);
        IWorkbook workbook = callbackObj.getWorkbookXLS(tTitle, tSubtitle, tSource, tKeywords, tTableData, tSvg);
        workbook.SaveToStream(tData, FileFormat.Excel8);
        tData.Close();
        tData.Dispose();
        workbook.Close();
        #region Download at client side
        Response.ClearContent();
        Response.ClearHeaders();
        Response.ContentType = tType;
        Response.AppendHeader("Content-Disposition", "attachment; filename=\"" + tFileName + tExt + "\"");
        Response.BinaryWrite(tData.ToArray());
        Response.End();
        #endregion
    }
开发者ID:SDRC-India,项目名称:sdrcdevinfo,代码行数:63,代码来源:ExportVisualization.aspx.cs

示例2: SaveGalleryItem


//.........这里部分代码省略.........
                    MemoryStream picStream = new MemoryStream(Convert.FromBase64String(imgInText));
                    System.Drawing.Image chartImage = System.Drawing.Image.FromStream(picStream);
                    Bitmap bmp = new Bitmap(chartImage, 269, 150);
                    bmp.Save(Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, folderStructure + RetVal + "\\" + RetVal + "_t.png"), System.Drawing.Imaging.ImageFormat.Png);
                    bmp.Dispose();
                    bmp = new Bitmap(chartImage, 584, 326);
                    bmp.Save(Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, folderStructure + RetVal + "\\" + RetVal + ".png"), System.Drawing.Imaging.ImageFormat.Png);
                    bmp.Dispose();
                    chartImage.Dispose();
                    this.Create_File(Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, "stock\\templates\\swfvisualizer.html"), Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, folderStructure + RetVal + "\\" + RetVal + ".html"));
                    this.Save_Settings_File(Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, folderStructure + RetVal + "\\" + RetVal + ".xml"), SettingData);
                    Callback callbackObj = new Callback(this.Page);
                    IWorkbook workbook = callbackObj.getWorkbookForSwf(title, subtitle, source, keywords, tableData, imgInText);
                    workbook.SaveAs(Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, folderStructure + RetVal + "\\" + RetVal + ".xls"), SpreadsheetGear.FileFormat.XLS97);
                    workbook.Close();
                }
                #endregion
                #region Save details for Map
                else if (ChartType == "map")
                {
                    SaveKMLMap(Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, folderStructure + RetVal), RetVal);
                    SavePngMap(Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, folderStructure + RetVal), RetVal + "_t", false, false, 150, 269);
                    SavePngMap(Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, folderStructure + RetVal), RetVal, true, true, 326, 584);
                    SaveExcelMap(Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, folderStructure + RetVal), RetVal);
                    //SaveMap(string FolderNameWPath, string FileName)
                }
                #endregion
                #region Save details for table
                else if (ChartType == "table")
                {
                    this.Create_File(Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, "stock\\templates\\table.png"), Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, folderStructure + RetVal + "\\" + RetVal + ".png"));
                    this.Create_File(Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, "stock\\templates\\table_t.png"), Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, folderStructure + RetVal + "\\" + RetVal + "_t.png"));
                    Callback callbackObj = new Callback(this.Page);
                    IWorkbook workbook = callbackObj.getWorkbookXLS(title, subtitle, source, keywords, tableData, imgInText);
                    workbook.SaveAs(Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, folderStructure + RetVal + "\\" + RetVal + ".xls"), FileFormat.XLS97);
                    workbook.Close();
                    SettingData = SettingData.Replace("[******]", "[****]");
                    WriteHTMLtoFile(SettingData, Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, folderStructure + RetVal + "\\" + RetVal + ".html"));

                }
                #endregion
                #region Save details for treemap
                else if (ChartType == "treemap" || ChartType == "cloud")
                {
                    string thumbImage = string.Empty;
                    string bigImage = string.Empty;
                    if (ChartType == "treemap")
                    {
                        thumbImage = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, "stock\\templates\\treemap_t.png");
                        bigImage = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, "stock\\templates\\treemap.png");
                    }
                    else
                    {
                        thumbImage = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, "stock\\templates\\cloud_t.png");
                        bigImage = Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, "stock\\templates\\cloud.png");
                    }
                    this.Create_File(bigImage, Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, folderStructure + RetVal + "\\" + RetVal + ".png"));
                    this.Create_File(thumbImage, Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, folderStructure + RetVal + "\\" + RetVal + "_t.png"));
                    Callback callbackObj = new Callback(this.Page);
                    IWorkbook workbook = callbackObj.getWorkbookXLS(title, subtitle, source, keywords, tableData, imgInText);
                    workbook.SaveAs(Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, folderStructure + RetVal + "\\" + RetVal + ".xls"), SpreadsheetGear.FileFormat.XLS97);
                    workbook.Close();

                    this.Save_Settings_File(Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, folderStructure + RetVal + "\\" + RetVal + ".xml"), SettingData);
                    File.WriteAllText(Path.Combine(HttpContext.Current.Request.PhysicalApplicationPath, folderStructure + RetVal + "\\" + RetVal + ".html"), imgInText);
                }
开发者ID:SDRC-India,项目名称:sdrcdevinfo,代码行数:67,代码来源:GalleryCallback.cs


注:本文中的Callback.getWorkbookXLS方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。