public override ISheet GetPrimarySheet() { XElement primarySheet = DOMUtils.GetFirstElementByTagName(GetWorkbookElement(), TAG_SHEET); if (primarySheet != null) { return((ISheet)GetAdaptableRegistry().GetAdaptable(primarySheet)); } return(null); }
/// <summary> /// Gets primary sheet /// </summary> /// <returns></returns> public override ISheet GetPrimarySheet() { XElement primarySheet = DOMUtils.GetFirstElementByTagName(GetWorkbookElement(), TAG_SHEET); if (primarySheet == null) { const string errorMessage = "Primary sheet was not found"; Logger.Log.Error(errorMessage); throw new InvalidOperationException(errorMessage); } return((ISheet)GetAdaptableRegistry().GetAdaptable(primarySheet) !); }
// private string _fileName = null; /// <summary> /// Creates a new XMind workbook if loadContent is false, otherwise the file content will be loaded. /// </summary> // /// <param name="loadContent">If true, the current data from the file will be loaded, otherwise an empty workbook will be created.</param> internal XMindWorkBook(string name, XMindConfiguration bookConfiguration, IXMindDocumentBuilder builder) { Name = name; _xMindSettings = XMindConfigurationLoader.Configuration.XMindConfigCollection; this._bookConfiguration = bookConfiguration; _documentBuilder = builder; _documentBuilder.CreateMetaFile(); _documentBuilder.CreateManifestFile(); _documentBuilder.CreateContentFile(); _implementation = _documentBuilder.ContentFile.Descendants().First(); _adaptableRegistry = new NodeAdaptableRegistry(_documentBuilder.ContentFile, this); //Create default sheet if needed //TODO: if (DOMUtils.GetFirstElementByTagName(_implementation, TAG_SHEET) == null) { AddSheet(CreateSheet()); } }