public void Generate(string xml, Stream output) { parser = new ExcelXmlParser(); try { parser.setXML(xml); createExcel(output); setColorProfile(); headerPrint(parser); rowsPrint(parser, output); wb.Workbook.Document.Styles.Save(); // remove repeat foot # charlot // footerPrint(parser); insertHeader(parser, output); insertFooter(parser, output); watermarkPrint(parser); //// merge head //sheet.MergeTwoCells("A1","A3"); //sheet.Save(); wb.Dispose(); } catch (Exception e) { // e.printStackTrace(); } }
public void Generate(string xml, Stream output) { parser = new ExcelXmlParser(); try { parser.setXML(xml); createExcel(output); setColorProfile(); headerPrint(parser); rowsPrint(parser, output); wb.Workbook.Document.Styles.Save(); if (PrintFooter) { footerPrint(parser); } insertHeader(parser, output); insertFooter(parser, output); watermarkPrint(parser); wb.Dispose(); } catch (Exception) { throw; } }
public void TestOpen() { ExcelDocument doc = null; using (MemoryStream ms = new MemoryStream(EXCEL.ToByteArrayFromBase64String())) { doc = ExcelDocument.OpenDocument(ms); Assert.AreEqual(4, doc.GetAllWorksheets().Length); } ExcelWorksheet worksheet = doc.GetAllWorksheets()[0]; ExcelFormatter formatter = worksheet.GetFormatterAt( new ExcelCellName(new ColumnLetter(Letter.A), 1), new ExcelCellName(new ColumnLetter(Letter.C), 3)); Assert.AreEqual(Color.FromArgb(0, 255, 0, 0), formatter.Background); Assert.AreEqual(Color.FromArgb(0, 255, 255, 0), formatter.Foreground); doc.Dispose(); }