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(); }
private void SaveTheme(ExcelSaveContext context) { if (this._Theme != null) { ((IPersistable)this._Theme).Save(context); } }
private void SaveWorkSheets(ExcelSaveContext context) { foreach (var sheet in this.Sheets) { ((IPersistable)sheet).Save(context); } }
void IPersistable.Save(ExcelSaveContext context) { context.LinqWriter.WriteCore(); context.LinqWriter.WriteApp(); if (this._XmlPropertiesCustom != null) { context.LinqWriter.WriteCustom(); } }
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); //} }
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 }
void IPersistable.Save(ExcelSaveContext context) { context.LinqWriter.WriteWrokSheetDrawing(this); }
//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.); }
void IPersistable.Save(ExcelSaveContext context) { this.ID = context.NextTableID; context.NextTableID++; context.LinqWriter.WriteTable(this); }
void IPersistable.Save(ExcelSaveContext context) { context.LinqWriter.WriteCalculation(this); }
//todo: // HeaderFooterWrapper //PrinterSettingsWrapper #region "Save" void IPersistable.Save(ExcelSaveContext context) { SaveChangeTableCell(); context.LinqWriter.WriteWorkSheet(this); }