/// <summary> /// Create a new blank spreadsheet document. /// </summary> public void New() { this.LoadBlankContent(); this.NamespaceManager = TextDocumentHelper.NameSpace(this._xmldoc.NameTable); this.DocumentConfigurations2 = new DocumentConfiguration2(); this.DocumentManifest = new DocumentManifest(); this.DocumentManifest.New(); this.DocumentMetadata = new DocumentMetadata(this); this.DocumentMetadata.New(); this.DocumentPictures = new DocumentPictureCollection(); this.DocumentSetting = new DocumentSetting(); this.DocumentSetting.New(); this.DocumentStyles = new DocumentStyles(); this.DocumentStyles.New(); this.ReadCommonStyles(); this.DocumentThumbnails = new DocumentPictureCollection(); }
/// <summary> /// Load the given file. /// </summary> /// <param name="file"></param> public void Load(string file) { try { this._isLoadedFile = true; this.LoadBlankContent(); this.NamespaceManager = TextDocumentHelper.NameSpace(this._xmldoc.NameTable); ImportHandler importHandler = new ImportHandler(); IImporter importer = importHandler.GetFirstImporter(DocumentTypes.SpreadsheetDocument, file); if (importer != null) { if (importer.NeedNewOpenDocument) { this.New(); } importer.Import(this, file); if (importer.ImportError != null) { if (importer.ImportError.Count > 0) { foreach (object ob in importer.ImportError) { if (ob is AODLWarning) { if (((AODLWarning)ob).Message != null) { Console.WriteLine("Err: {0}", ((AODLWarning)ob).Message); } if (((AODLWarning)ob).Node != null) { XmlTextWriter writer = new XmlTextWriter(Console.Out); writer.Formatting = Formatting.Indented; ((AODLWarning)ob).Node.WriteContentTo(writer); } } } } } } } catch (Exception ex) { throw; } }