Click here to Skip to main content
16,004,924 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionRadio button Pin
acodman13-Jun-06 20:57
acodman13-Jun-06 20:57 
AnswerRe: Radio button [modified] Pin
Guffa13-Jun-06 21:07
Guffa13-Jun-06 21:07 
QuestionData Access Layer Pin
guitardave7813-Jun-06 20:57
guitardave7813-Jun-06 20:57 
Questionadding rows manually in a datagrid to implement tree structure [modified] Pin
shah zad13-Jun-06 20:46
shah zad13-Jun-06 20:46 
QuestionUrgent guidance required reg. Session [modified] Pin
kumar.m13-Jun-06 20:25
kumar.m13-Jun-06 20:25 
QuestionFileIOPermission failed when uploading to hosted app Pin
travyjeremus13-Jun-06 19:47
travyjeremus13-Jun-06 19:47 
AnswerRe: FileIOPermission failed when uploading to hosted app Pin
Paddy Boyd13-Jun-06 23:43
Paddy Boyd13-Jun-06 23:43 
QuestionSaving Excel from Template urgent Pin
Suamal13-Jun-06 19:20
Suamal13-Jun-06 19:20 
using System.IO;
using excel09;
using System.Reflection ;
using System.Runtime.InteropServices;

I am creating a new excel file of version 9 from template of excel 2003.
An Image is there in the template file.

The excel file is got saved and opened.But image is not getting displayed.

Code is

Page.Controls.Clear();
Response.ContentType = "application/vnd.ms-excel";
Response.Buffer=true;
//To open excel files in lower versions also

//Save the byte[] array to xl template file
string xlFileName = "Template.xlt";
string xlFilePath = Server.MapPath("../Reports/") + xlFileName;

string fileExcel = Server.MapPath("../Reports/" + xlFileName); //template file


//Creating instance for excel 9 version

//To create excel file in lower version
excel09.Application ExcelObj = new excel09.Application();
ExcelObj.Visible = true;



xlFileName = "Report - " + System.DateTime.Now.Ticks.ToString() +".xls";
xlFilePath = Server.MapPath("../Reports/") + xlFileName; //Save as file name

//Adding template to workbook

ExcelObj.Workbooks.Add(fileExcel);
Workbooks workbooks = ExcelObj.Workbooks;

_Workbook workbook = workbooks.get_Item(1);
Sheets sheets = workbook.Worksheets;
_Worksheet worksheet = (_Worksheet) sheets.get_Item(1);

//Saving excel file in 9 version format
workbook.SaveAs(xlFilePath, excel09.XlFileFormat.xlWorkbookNormal,null,null,false,false,excel09.XlSaveAsAccessMode.xlShared,false,false,null,null);


workbook.Close(null,null,null);

ExcelObj.Workbooks.Close();
ExcelObj.Quit();


System.Runtime.InteropServices.Marshal.ReleaseComObject (ExcelObj);
System.Runtime.InteropServices.Marshal.ReleaseComObject (sheets);
System.Runtime.InteropServices.Marshal.ReleaseComObject (workbook);

ExcelObj = null;
workbook = null;
sheets=null;
System.GC.Collect();

//Getting from excel version 9 file
Response.WriteFile(xlFilePath);
Response.Flush();
Response.Buffer=false;
Response.End();

QuestionProblem saving excel Urgent Pin
Suamal13-Jun-06 19:11
Suamal13-Jun-06 19:11 
QuestionCss problem Pin
sagarv_shinde@yahoo.com13-Jun-06 18:47
sagarv_shinde@yahoo.com13-Jun-06 18:47 
AnswerRe: Css problem Pin
Guffa13-Jun-06 20:31
Guffa13-Jun-06 20:31 
GeneralRe: Css problem Pin
sagarv_shinde@yahoo.com13-Jun-06 23:05
sagarv_shinde@yahoo.com13-Jun-06 23:05 
GeneralRe: Css problem Pin
Guffa14-Jun-06 1:47
Guffa14-Jun-06 1:47 
Questionhow to create a chat application Pin
NZack NAs13-Jun-06 18:35
NZack NAs13-Jun-06 18:35 
QuestionRestricting datagrid When Bind with Arraylist Pin
varshavmane13-Jun-06 18:20
varshavmane13-Jun-06 18:20 
AnswerRe: Restricting datagrid When Bind with Arraylist Pin
Suamal13-Jun-06 19:31
Suamal13-Jun-06 19:31 
GeneralRe: Restricting datagrid When Bind with Arraylist Pin
varshavmane13-Jun-06 19:44
varshavmane13-Jun-06 19:44 
AnswerRe: Restricting datagrid When Bind with Arraylist Pin
minhpc_bk13-Jun-06 22:45
minhpc_bk13-Jun-06 22:45 
QuestionXmlDataSource using an aspx DataFile [modified] Pin
RX Maverick13-Jun-06 17:47
RX Maverick13-Jun-06 17:47 
AnswerRe: XmlDataSource using an aspx DataFile Pin
minhpc_bk13-Jun-06 21:34
minhpc_bk13-Jun-06 21:34 
GeneralRe: XmlDataSource using an aspx DataFile Pin
RX Maverick14-Jun-06 3:24
RX Maverick14-Jun-06 3:24 
GeneralRe: XmlDataSource using an aspx DataFile Pin
minhpc_bk14-Jun-06 15:59
minhpc_bk14-Jun-06 15:59 
QuestionLocalization and dynamic user controls(page lifecycle) Pin
Leftyfarrell13-Jun-06 17:19
Leftyfarrell13-Jun-06 17:19 
AnswerRe: Localization and dynamic user controls(page lifecycle) Pin
minhpc_bk13-Jun-06 21:33
minhpc_bk13-Jun-06 21:33 
AnswerRe: Localization and dynamic user controls(page lifecycle) Pin
Leftyfarrell14-Jun-06 13:36
Leftyfarrell14-Jun-06 13:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.