Esempio n. 1
0
        private void InnerSave(Package package)
        {
            // 创建一个新的 workbookpart
            ExcelSaveContext context = new ExcelSaveContext(this)
            {
                Package = package
            };

            context.LinqWriter.WriteWorkBook();
            SaveWorkSheets(context);

            context.LinqWriter.WriteSharedStrings();

            ((IPersistable)this.FileDetails).Save(context);

            ((IPersistable)context.GlobalStyles).Save(context);

            ((IPersistable)this.CalculationChain).Save(context);

            SaveTheme(context);

            package.CreateRelationship(PackUriHelper.GetRelativeUri(new Uri("/xl", UriKind.Relative),
                                                                    ExcelCommon.Uri_Workbook),
                                       TargetMode.Internal,
                                       ExcelCommon.Schema_Relationships + "/officeDocument");

            package.Flush();
        }
Esempio n. 2
0
 private void SaveTheme(ExcelSaveContext context)
 {
     if (this._Theme != null)
     {
         ((IPersistable)this._Theme).Save(context);
     }
 }
Esempio n. 3
0
 private void SaveWorkSheets(ExcelSaveContext context)
 {
     foreach (var sheet in this.Sheets)
     {
         ((IPersistable)sheet).Save(context);
     }
 }
Esempio n. 4
0
        void IPersistable.Save(ExcelSaveContext context)
        {
            context.LinqWriter.WriteCore();
            context.LinqWriter.WriteApp();

            if (this._XmlPropertiesCustom != null)
            {
                context.LinqWriter.WriteCustom();
            }
        }
Esempio n. 5
0
        void IPersistable.Save(ExcelSaveContext context)
        {
            if (this._Theme != null)
            {
                PackagePart themePart = context.Package.CreatePart(ExcelCommon.Uri_Theme, ExcelCommon.ContentType_Theme, this._WorkBook.Compression);
                context.Package.GetPart(ExcelCommon.Uri_Workbook).CreateRelationship(PackUriHelper.GetRelativeUri(ExcelCommon.Uri_Workbook, ExcelCommon.Uri_Theme), TargetMode.Internal, ExcelCommon.Schema_Relationships + "/theme");

                using (StreamWriter streamCore = new StreamWriter(themePart.GetStream(FileMode.Create, FileAccess.Write)))
                {
                    this._Theme.Save(streamCore);
                }

                /*	using (XmlTextWriter writer = new XmlTextWriter(themePart.GetStream(FileMode.Create, FileAccess.Write), Encoding.UTF8))
                 *    {
                 *            context.Writer.WriteTheme(this, writer);
                 *    } */
            }

            //PackagePart themePart = context.Package.GetPart(ExcelCommon.Uri_Workbook).CreatePart(ExcelCommon.Uri_Theme, ExcelCommon.ContentType_Theme, this._WorkBook.Compression);
            //using (XmlTextWriter writer = new XmlTextWriter(themePart.GetStream(FileMode.Create, FileAccess.Write), Encoding.UTF8))
            //{
            //    context.Writer.WriteTheme(this, writer);
            //}
        }
Esempio n. 6
0
 void IPersistable.Save(ExcelSaveContext context)
 {
     context.LinqWriter.WriteStyles(this);
 }
 void IPersistable.Save(ExcelSaveContext context)
 {
     context.LinqWriter.WriteComments(this);
     context.LinqWriter.WriteCommentsVmlDrawing(this);
 }
 void IPersistable.Save(ExcelSaveContext context)
 {
     context.LinqWriter.WriteReadHeaderFooterVmlDrawingPicture(this);
     //HeaderFooterVmlDrawingPicture
 }
Esempio n. 9
0
 void IPersistable.Save(ExcelSaveContext context)
 {
     context.LinqWriter.WriteWrokSheetDrawing(this);
 }
Esempio n. 10
0
        //internal ChartDataLabel _DataLabel = null;

        //public ChartDataLabel DataLabel
        //{
        //    get
        //    {
        //        if (this._DataLabel == null)
        //            this._DataLabel = new ChartDataLabel(this, false);

        //        return this._DataLabel;
        //    }
        //}
        //internal CategoryAxisData _CategoryAxisData = null;
        //public CategoryAxisData CategoryAxisData
        //{
        //    get
        //    {
        //        if (this._CategoryAxisData == null)
        //            this._CategoryAxisData = new CategoryAxisData();

        //        return this._CategoryAxisData;
        //    }
        //}

        //internal CategoryAxisValue _CategoryAxisValue = null;
        //public CategoryAxisValue CategoryAxisValue
        //{
        //    get
        //    {
        //        if (this._CategoryAxisValue == null)
        //            this._CategoryAxisValue = new CategoryAxisValue();

        //        return this._CategoryAxisValue;
        //    }
        //}



        void IPersistable.Save(ExcelSaveContext context)
        {
            //context.LinqWriter.WriteWrokSheetChart(this,context.);
        }
Esempio n. 11
0
 void IPersistable.Save(ExcelSaveContext context)
 {
     this.ID = context.NextTableID;
     context.NextTableID++;
     context.LinqWriter.WriteTable(this);
 }
Esempio n. 12
0
 void IPersistable.Save(ExcelSaveContext context)
 {
     context.LinqWriter.WriteCalculation(this);
 }
Esempio n. 13
0
        //todo:
        // HeaderFooterWrapper
        //PrinterSettingsWrapper

        #region "Save"
        void IPersistable.Save(ExcelSaveContext context)
        {
            SaveChangeTableCell();
            context.LinqWriter.WriteWorkSheet(this);
        }