private static OXmlPageSize ReadPageSize(BsonReader bsonReader)
 {
     bsonReader.ReadStartDocument();
     OXmlPageSize value = new OXmlPageSize();
     while (true)
     {
         BsonType bsonType = bsonReader.ReadBsonType();
         if (bsonType == BsonType.EndOfDocument)
             break;
         string name = bsonReader.ReadName();
         switch (name.ToLower())
         {
             case "width":
                 if (bsonType == BsonType.Null)
                     break;
                 if (bsonType != BsonType.Int32)
                     throw new PBException($"wrong PageSize width value {bsonType}");
                 value.Width = bsonReader.ReadInt32();
                 break;
             case "height":
                 if (bsonType == BsonType.Null)
                     break;
                 if (bsonType != BsonType.Int32)
                     throw new PBException($"wrong PageSize height value {bsonType}");
                 value.Height = bsonReader.ReadInt32();
                 break;
             default:
                 throw new PBException($"unknow PageSize value \"{name}\"");
         }
     }
     bsonReader.ReadEndDocument();
     return value;
 }
Esempio n. 2
0
        private static PageSize CreatePageSize(OXmlPageSize oXmlPageSize)
        {
            if (oXmlPageSize == null)
            {
                return(null);
            }
            PageSize pageSize = new PageSize();

            if (oXmlPageSize.Width != null)
            {
                pageSize.Width = (uint)oXmlPageSize.Width;
            }
            if (oXmlPageSize.Height != null)
            {
                pageSize.Height = (uint)oXmlPageSize.Height;
            }
            return(pageSize);
        }
Esempio n. 3
0
 private static PageSize CreatePageSize(OXmlPageSize oXmlPageSize)
 {
     if (oXmlPageSize == null)
         return null;
     PageSize pageSize = new PageSize();
     if (oXmlPageSize.Width != null)
         pageSize.Width = (uint)oXmlPageSize.Width;
     if (oXmlPageSize.Height != null)
         pageSize.Height = (uint)oXmlPageSize.Height;
     return pageSize;
 }