public void SaveXls(string fileName) { XLSFileWriter writer = new XLSFileWriter(this, fileName); using (FileStream stream = new FileStream(fileName, FileMode.Create)) { SaveXLSInternal(stream, writer.GetRecords(), this.summaryStream, this.documentSummaryStream, this.macrosesStream, this.HasMacroses); } }
private static void SaveXLSInternal(AbsXLSRecords records, string fileName, byte[] ss, byte[] dss) { StructuredStorageFileBase base1 = StructuredStorageFileBase.Create(fileName); base1.WriteStream("Workbook", XLSFileWriter.GetStream(records)); if (ss != null) { base1.WriteStream("" + '\x0005' + "SummaryInformation", ss); } if (dss != null) { base1.WriteStream("" + '\x0005' + "DocumentSummaryInformation", dss); } base1.Close(); }
private static void SaveXLSInternal(Stream stream, AbsXLSRecords records, byte[] ss, byte[] dss, byte[] macrosesStream, bool hasMacroses) { using (Ole2CompoundFile file = new Ole2CompoundFile()) { file.Root.AddStream("Workbook", XLSFileWriter.GetStream(records)); if (ss != null) { file.Root.AddStream("\x0005SummaryInformation", ss); } if (dss != null) { file.Root.AddStream("\x0005DocumentSummaryInformation", dss); } file.Save(stream); } }
///<summary> ///Saves all data to a new file in XLS format. ///</summary> ///<param name="fileName">File name.</param> public void SaveXls(string fileName) { XLSFileWriter writer1 = new XLSFileWriter(this, fileName); ExcelFile.SaveXLSInternal(writer1.GetRecords(), fileName, this.summaryStream, this.documentSummaryStream); }