private Worksheet ProcessGetWorksheet(OXWorkbookWorksheetEntry e) { OXRelation r = _excelRelations.GetRelation(e.RelationId); if (r == null) { throw new Exception(string.Format("Relationship id {0} does not exist in the relationships for worksheet name {1}", e.RelationId, e.Name)); } string subPath = r.Target.Replace('/', '\\'); string path = null; if (subPath.StartsWith(@"\xl")) { path = subPath.Substring(1); } else { path = @"xl\" + subPath; } OXWorksheet ows = OXNS.Load <OXWorksheet>( _f, path ); if (ows == null) { throw new Exception(string.Format("Worksheet target {0} does not exist for relation id {1}", r.Target, r.Id)); } return(new Worksheet(this, e.Name, ows)); }
private Worksheet ProcessGetWorksheet(OXWorkbookWorksheetEntry e) { OXRelation r = _excelRelations.GetRelation(e.RelationId); if (r == null) { throw new Exception(string.Format("Relationship id {0} does not exist in the relationships for worksheet name {1}", e.RelationId, e.Name)); } OXWorksheet ows = OXNS.Load <OXWorksheet>( _f, @"xl\" + r.Target.Replace('/', '\\') ); if (ows == null) { throw new Exception(string.Format("Worksheet target {0} does not exist for relation id {1}", r.Target, r.Id)); } return(new Worksheet(this, e.Name, ows)); }
public Workbook(ZipFile f) { _wb = OXNS.Load <OXWorkbook>(f, OXWorkbook.DefaultPath); if (_wb == null) { throw new InvalidOperationException("File contains no workbook"); } _excelRelations = OXNS.Load <OXRelationCollection>(f, OXRelationCollection.DefaultExcelRelationPath); if (_excelRelations == null) { throw new InvalidOperationException("File contains no excel relationship map"); } _styleSheet = OXNS.Load <OXStyleSheet>(f, OXStyleSheet.DefaultPath); _sst = OXNS.Load <OXSST>(f, OXSST.DefaultPath); _f = f; }