public void TestAddMacroSheet() { byte[] wbBytes = TestHelpers.GetTemplateMacroBytes(); WorkbookStream wbs = new WorkbookStream(wbBytes); byte[] mtBytes = TestHelpers.GetMacroTestBytes(); WorkbookStream macroWorkbookStream = new WorkbookStream(mtBytes); BoundSheet8 macroSheet = new BoundSheet8(BoundSheet8.HiddenState.Visible, BoundSheet8.SheetType.Macrosheet, "MacroSheet"); List <BOF> macroWorkbookBofs = macroWorkbookStream.GetAllRecordsByType <BOF>(); BOF LastBofRecord = macroWorkbookBofs.Last(); List <BiffRecord> sheetRecords = macroWorkbookStream.GetRecordsForBOFRecord(LastBofRecord); byte[] sheetBytes = RecordHelper.ConvertBiffRecordsToBytes(sheetRecords); wbs = wbs.AddSheet(macroSheet, sheetBytes); ExcelDocWriter writer = new ExcelDocWriter(); writer.WriteDocument(TestHelpers.AssemblyDirectory + Path.DirectorySeparatorChar + "addedsheet.xls", wbs.ToBytes()); }