Excel.Save is not saving all the content to Memory Stream


#1

//Initializing the Aspose Cells object.

Aspose.Cells.Excel objExcel = new Aspose.Cells.Excel();

Aspose.Cells.Worksheet objWorkSheet = objExcel.Worksheets[0];

Worksheets sheets = objExcel.Worksheets;

//Add a worksheet

sheets.Add();

//Change the name of a worksheet

sheets[0].Name = "Technical Control";

objWorkSheet = sheets[0];

//Set the active sheet to the second worksheet

sheets.ActiveSheetIndex = 0;

//Code written where I am populating this Excel Worksheet with data

ms = new MemoryStream();

objExcel.Save(ms,FileFormatType.Excel2003);

return ms;

This Memory Stream donot have the whole content it contains only Evalution Warning Sheet when I am taking this stream out and displaying it in browser. I have a limitation that I cannot use Response Object in Excel.Save method. However if I save the objExcel to file on hard disk and open it and assign to stream then it is taking the whole content.

objExcel.Save(filePath,FileFormatType.Excel2003);

saves all the data to file at specified path but donot save it in Memory Stream. I am right now using evaluation version. Please let me know is this a problem with evaluation version or with DLL.


#2

I don't find this problem.

1. Please click the tab scrolling button to check if other sheets are hidden.

2. If it still doesn't show, please try this attached version with following sample code:

//Initializing the Aspose Cells object.

Aspose.Cells.Workbook objExcel = new Aspose.Cells.Workbook();

Aspose.Cells.Worksheet objWorkSheet = objExcel.Worksheets[0];

Worksheets sheets = objExcel.Worksheets;

//Add a worksheet

sheets.Add();

//Change the name of a worksheet

sheets[0].Name = "Technical Control";

objWorkSheet = sheets[0];

//Set the active sheet to the second worksheet

sheets.ActiveSheetIndex = 0;

//Code written where I am populating this Excel Worksheet with data

MemoryStream ms = new MemoryStream();

objExcel.Save(ms,FileFormatType.Excel2003);


FileStream fs = new FileStream("d:\\test\\abc.xls", FileMode.Create, FileAccess.ReadWrite);

ms.WriteTo(fs);

ms.Close();
fs.Close();

3. If the problem still occurs, please post your sample project here. I will check it ASAP.