2013-11-14 40 views
0

我已經編寫了一個簡單的控制檯程序(用C#)生成PowerPoint演示文稿,但我需要能夠設置對象(文本,圖片等)通過一個基於SharePoint頁面的asp.net表單,目前這可以在任何地方都可以保存演示文稿,但我需要將它從SharePoint輸出爲用戶下載。我正在尋找如何去做這樣的事情的任何指針。我理解表單和請求參數等的使用,但不知道如何去讓程序運行服務器端並輸出可下載的文件。基於SharePoint的表單提交給C#應用程序,爲用戶下載創建Powerpoint 2007演示文稿

任何幫助,非常感謝。

我會張貼一些代碼,但我是非常新的ASP,所以這是非常多的研究,我如何去做這樣的事情。據我所見,生病不得不從SharePoint列表填充表格。

+0

也許張貼一些代碼 –

回答

0

你可以直接在你的asp.net WebApp上做。 就像這樣:

  ExcelWorksheet worksheet = package.Workbook.Worksheets.Add("Pos Venda"); 

      #region tabelaPrincipal 

      worksheet.Cells[1, 1, 1, 9].Style.Fill.PatternType = OfficeOpenXml.Style.ExcelFillStyle.Solid; 
      worksheet.Cells[1, 1, 1, 9].Style.Fill.BackgroundColor.SetColor(System.Drawing.Color.FromArgb(149, 179, 215)); 
      worksheet.Cells[1, 1, 1, 9].Style.Border.BorderAround(OfficeOpenXml.Style.ExcelBorderStyle.Medium, System.Drawing.Color.Black); 

      worksheet.Cells[1, 1].Value = "N. O.S."; 
      worksheet.Cells[1, 2].Value = "DATA"; 
      worksheet.Cells[1, 3].Value = "TECNICO"; 
      worksheet.Cells[1, 4].Value = "TEMPO"; 
      worksheet.Cells[1, 5].Value = "ATIVIDADE"; 
      worksheet.Cells[1, 6].Value = "COMO"; 
      worksheet.Cells[1, 7].Value = "EMPRESA"; 
      worksheet.Cells[1, 8].Value = "VALOR"; 
      worksheet.Cells[1, 9].Value = "SITUACAO"; 
      package.Workbook.Properties.Title = "Relatório de Pós Venda"; 
      package.Workbook.Properties.Author = "SGP"; 
      package.Workbook.Properties.Company = "Libracom Automação Industrial Ltda."; 

      Response.Clear(); 
      Response.ClearContent(); 
      Response.ClearHeaders(); 
      Response.ContentType = "application/x-msexcel"; 
      Response.AddHeader("Content-Disposition", String.Format("attachment;filename=\"{0}\"", "Relatorio" + DateTime.Now.ToString("ddMMyyyyHHmmss") + ".xlsx")); 
      Response.BinaryWrite(package.GetAsByteArray()); 
      Response.Flush(); 
      Response.SuppressContent = true; 
      ApplicationInstance.CompleteRequest(); 
      Response.End(); 

@edit:使用EPPlus DLL。 http://epplus.codeplex.com/

相關問題