Пример #1
0
        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));
        }
Пример #2
0
        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));
        }