internal void Write(BinaryWriter writer, bool isFirstPage, ExcelGeneratorConstants.CreateTempStream createTempStream, Stream backgroundImage, ushort backgroundImageWidth, ushort backgroundImageHeight) { BOFStartOffset = writer.BaseStream.Position; RecordFactory.BOF(writer, RecordFactory.BOFSubstreamType.Worksheet); RecordFactory.INDEX(writer, RowFirst, RowLast, DBCellOffsets); writer.BaseStream.Write(Constants.WORKSHEET1, 0, Constants.WORKSHEET1.Length); RecordFactory.GUTS(writer, m_maxRowOutline, m_maxColOutline); RecordFactory.WSBOOL(writer, m_summaryRowBelow, m_summaryColumnToRight); writer.BaseStream.Write(Constants.WORKSHEET2, 0, Constants.WORKSHEET2.Length); RecordFactory.SETUP(writer, (ushort)m_paperSize, m_isPortrait, m_headerMargin, m_footerMargin); RecordFactory.MARGINS(writer, m_topMargin, m_bottomMargin, m_leftMargin, m_rightMargin); if (backgroundImage != null) { RecordFactory.BACKGROUNDIMAGE(writer, backgroundImage, backgroundImageWidth, backgroundImageHeight); } if (HeaderString != null && HeaderString.Length > 0) { RecordFactory.HEADER(writer, HeaderString); } if (FooterString != null && FooterString.Length > 0) { RecordFactory.FOOTER(writer, FooterString); } for (int i = ColFirst; i <= ColLast; i++) { ColumnInfo columnInfo = Columns[i]; if (columnInfo != null) { RecordFactory.COLINFO(writer, (ushort)i, columnInfo.Width, columnInfo.OutlineLevel, columnInfo.Collapsed); } else { RecordFactory.COLINFO(writer, (ushort)i, 0.0, 0, collapsed: false); } } RecordFactory.DIMENSIONS(writer, RowFirst, RowLast, ColFirst, ColLast); byte[] array = new byte[4096]; CellData.Seek(0L, SeekOrigin.Begin); int count; while ((count = CellData.Read(array, 0, array.Length)) > 0) { writer.BaseStream.Write(array, 0, count); } CellData.Close(); CellData = null; if (m_drawingContainer != null) { foreach (ImageCache image in m_images) { if (image.HyperlinkURL == null) { m_drawingContainer.AddShape(image.ShapeID, image.Name, image.ClientAnchor, image.RefIndex); } else { m_drawingContainer.AddShape(image.ShapeID, image.Name, image.ClientAnchor, image.RefIndex, image.HyperlinkURL, image.IsBookmark ? Escher.HyperlinkType.BOOKMARK : Escher.HyperlinkType.URL); } } m_drawingContainer.WriteToStream(writer); } RecordFactory.WINDOW2(writer, m_rowSplit > 0 || m_columnSplit > 0, isFirstPage); if (m_rowSplit > 0 || m_columnSplit > 0) { RecordFactory.PANE(writer, m_columnSplit, m_rowSplit, m_rowSplit, m_columnSplit, 2); } writer.BaseStream.Write(Constants.WORKSHEET3, 0, Constants.WORKSHEET3.Length); RecordFactory.MERGECELLS(writer, MergeCellAreas); foreach (HyperlinkInfo hyperlink in m_hyperlinks) { RecordFactory.HLINK(writer, hyperlink); } writer.BaseStream.Write(Constants.WORKSHEET4, 0, Constants.WORKSHEET4.Length); }