Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
40
Save XLSX files to a memory stream
posted

We are using version 16.1.20161.2118 of Infragistics4.Win.UltraWinSpreadsheet.v16.1.  I am able to save a loaded Excel file into a memory stream in Excel97 format and load it back in Excel97 format successfully.  But when I try to save it to a memory stream in Excel2007 format I get an invalid or unrecognized file format  error when trying to load it back.

// save
SpreadSheet.Workbook.SetCurrentFormat(WorkbookFormat.Excel97To2003);
MemoryStream stream = new MemoryStream();
SpreadSheet.Workbook.Save(stream);

// load
Workbook wb = new Workbook(WorkbookFormat.Excel97To2003);
MemoryStream stream = new MemoryStream();
stream.Write(bytFile, 0, bytFile.Length - 1);
wb = Infragistics.Documents.Excel.Workbook.Load(stream);

How can I save a 2007+ file to a memory stream?

Parents
  • 21795
    Offline posted

    Hello Joe,

    I followed the steps you suggested and was unable to reproduce the behavior you are describing. I created a small sample project and added UltraSpreadSheet to it. Then I paste the code snippet you had provided. When I run my project, I did not receive any errors or exceptions.

    I have attached the sample project I used to test this. Please test this project on your PC; whether or not it works correctly may help indicate the nature of this issue.

    If the project does not work correctly, this indicates either an issue possibly specific to your environment, or a difference in the DLL versions we are using. My test was performed using Infragistics for Windows Forms 2016 volume 1 with latest service release. So could you please let me know the exact version of Infragistics components which you are using?

    If the project does show the product feature working correctly, this indicates a possible issue in the code of your application. It will help if you can provide a small, isolated sample application that demonstrates the behavior you are seeing.

    Or, if this sample project is not an accurate demonstration of what you're trying to do, please feel free to modify it and send it back.

    Please let me know if I can provide any further assistance.

    UltraSpreadSheetMemoryStream.zip
Reply Children