public bool TryCreateObject(ObjectType objectType, out IPersistable persistObj)
        {
            switch (objectType)
            {
            case ObjectType.WordOpenXmlTableGrid:
                persistObj = new OpenXmlTableGridModel();
                break;

            case ObjectType.WordOpenXmlTableRowProperties:
                persistObj = new OpenXmlTableRowPropertiesModel();
                break;

            case ObjectType.WordOpenXmlBorderProperties:
                persistObj = new OpenXmlBorderPropertiesModel();
                break;

            case ObjectType.WordOpenXmlHeaderFooterReferences:
                persistObj = new HeaderFooterReferences();
                break;

            default:
                persistObj = null;
                return(false);
            }
            return(true);
        }
Exemplo n.º 2
0
        public override void Deserialize(IntermediateFormatReader reader)
        {
            base.Deserialize(reader);
            reader.RegisterDeclaration(GetDeclaration());
            while (reader.NextMember())
            {
                switch (reader.CurrentMember.MemberName)
                {
                case MemberName.RowHeight:
                    _height = reader.ReadSingle();
                    break;

                case MemberName.LeftIndent:
                    _rowIndent = reader.ReadSingle();
                    break;

                case MemberName.ExactRowHeight:
                    _exactRowHeight = reader.ReadBoolean();
                    break;

                case MemberName.IgnoreRowHeight:
                    _ignoreRowHeight = reader.ReadBoolean();
                    break;

                case MemberName.TopPadding:
                    _maxPaddingTop = reader.ReadSingle();
                    break;

                case MemberName.BottomPadding:
                    _maxPaddingBottom = reader.ReadSingle();
                    break;

                case MemberName.TopBorder:
                    _borderTop = (OpenXmlBorderPropertiesModel)reader.ReadRIFObject();
                    break;

                case MemberName.BottomBorder:
                    _borderBottom = (OpenXmlBorderPropertiesModel)reader.ReadRIFObject();
                    break;

                case MemberName.LeftBorder:
                    _borderLeft = (OpenXmlBorderPropertiesModel)reader.ReadRIFObject();
                    break;

                case MemberName.RightBorder:
                    _borderRight = (OpenXmlBorderPropertiesModel)reader.ReadRIFObject();
                    break;

                case MemberName.Color:
                    _bgColor = reader.ReadString();
                    break;

                default:
                    WordOpenXmlUtils.FailSerializable();
                    break;
                }
            }
        }
 private static List <Declaration> BuildDeclarations()
 {
     return(new List <Declaration>(6)
     {
         BaseInterleaver.GetDeclaration(),
         OpenXmlTableGridModel.GetDeclaration(),
         OpenXmlTableRowPropertiesModel.GetDeclaration(),
         OpenXmlBorderPropertiesModel.GetDeclaration(),
         HeaderFooterReferences.GetDeclaration()
     });
 }
 private void UpdateBorder(OpenXmlBorderPropertiesModel cellBorder, OpenXmlBorderPropertiesModel tableBorder)
 {
     cellBorder.Color = tableBorder.Color;
     cellBorder.Style = tableBorder.Style;
     cellBorder.WidthInEighthPoints = tableBorder.WidthInEighthPoints;
 }