Пример #1
0
        public void SaveToStream(Stream stream)
        {
            CompoundDocument doc     = CompoundDocument.CreateFromStream(stream);
            MemoryStream     mstream = new MemoryStream();

            WorkbookEncoder.Encode(this, mstream);
            doc.WriteStreamData(new string[] { "Workbook" }, mstream.ToArray());
            doc.Save();
        }
Пример #2
0
        public void Save(string file)
        {
            CompoundDocument doc    = CompoundDocument.Create(file);
            MemoryStream     stream = new MemoryStream();

            WorkbookEncoder.Encode(this, stream);
            doc.WriteStreamData(new string[] { "Workbook" }, stream.ToArray());
            doc.Save();
            doc.Close();
        }
Пример #3
0
 /// <summary>
 /// Save workbook to a file.
 /// </summary>
 /// <param name="file"></param>
 public void Save(string file)
 {
     using (CompoundDocument doc = CompoundDocument.Create(file))
     {
         using (MemoryStream memStream = new MemoryStream())
         {
             WorkbookEncoder.Encode(this, memStream);
             doc.WriteStreamData(new string[] { "Workbook" }, memStream.ToArray());
             doc.Save();
         }
     }
 }
Пример #4
0
        public void Save(Stream s)
        {
            BinaryWriter bw = new BinaryWriter(s);

            //Writing Column Naow
            int TotalRows = this.Worksheets[0].Cells.LastRowIndex;

            for (int i = TotalRows + 1; i < TotalRows + 50; i++)
            {
                for (int ColumnCount = 0; ColumnCount < 5; ColumnCount++)
                {
                    this.Worksheets[0].Cells[i, ColumnCount] = new Cell("");
                }
            }

            CompoundDocument doc    = CompoundDocument.Create(s, bw);
            MemoryStream     stream = new MemoryStream();

            WorkbookEncoder.Encode(this, stream);
            doc.WriteStreamData(new string[] { "Workbook" }, stream.ToArray());

            doc.Save();
            doc.Close();
        }