Beispiel #1
0
        public ExtendedFilePropertiesPart Do(SpreadsheetDocument package, XlsxFileContent content)
        {
            var properties = new Properties();

            properties.AddNamespaceDeclaration("vt", "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes");
            properties.Append(
                new Application {
                Text = "Microsoft Excel"
            },
                new DocumentSecurity {
                Text = "0"
            },
                new ScaleCrop {
                Text = "false"
            },
                new HeadingPairs(
                    MakeVector(VectorBaseValues.Variant,
                               new Variant(new VTLPSTR {
                Text = "Ћисты"
            }),
                               new Variant(new VTInt32 {
                Text = content.Worksheets.Length.ToString()
            })
                               )
                    ),
                new TitlesOfParts(
                    MakeVector(VectorBaseValues.Lpstr,
                               content.Worksheets.Select(x => new VTLPSTR {
                Text = x.Title
            })
                               )
                    ),
                new Company {
                Text = content.Properties.Company
            },
                new LinksUpToDate {
                Text = "false"
            },
                new SharedDocument {
                Text = "false"
            },
                new HyperlinksChanged {
                Text = "false"
            },
                new ApplicationVersion {
                Text = "15.0300"
            }
                );

            var extendedFilePropertiesPart = package.AddNewPart <ExtendedFilePropertiesPart>();

            extendedFilePropertiesPart.Properties = properties;

            return(extendedFilePropertiesPart);
        }
Beispiel #2
0
        private void deserializeProperties(string content)
        {
            // split content at line break
            var contentLines = content.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);

            // deserialize each line as a property
            foreach (var line in contentLines)
            {
                var property = ObjectSerializer.Deserialize <CalendarTextProperty>(line);
                Properties.Append(property);
            }
        }
Beispiel #3
0
        public ExpressionModel()
        {
            Name = "Expression";

            Type = ModelType.Expression;

            Properties = Properties.Append((new Dictionary <string, ModelProperty>()
            {
                { "CategoryId", new ModelProperty()
                  {
                      IsVisible = false
                  } },
                { "ProjectId", new ModelProperty()
                  {
                      IsVisible = false
                  } },
                { "DataTypeId", new ModelProperty()
                  {
                      IsVisible = false
                  } },
                { "IntelliFlowId", new ModelProperty()
                  {
                      IsVisible = false
                  } },
                { "ParentId", new ModelProperty()
                  {
                      IsVisible = false
                  } },
                { "ParentItemId", new ModelProperty()
                  {
                      IsVisible = false
                  } },
                { "Value", new ModelProperty()
                  {
                      IsVisible = false
                  } },
            }).ToArray());
        }
 /// <summary>
 /// Assign a property value. If the property do not exists in the property collection, add the property to the collection
 /// </summary>
 /// <param name="propertyName">Name of the property</param>
 /// <param name="propertyValue">Value of the property</param>
 /// <param name="dataType">Data type: used in case of is needed to add the property to the property collection</param>
 public void AddProperty(string propertyName, object propertyValue, dao.DataTypeEnum dataType)
 {
     try {
         Properties[propertyName].Value = propertyValue;
     } catch (System.Runtime.InteropServices.COMException ex) {
         if (ex.ErrorCode == -2146825018)     //Property don't exists in the properties collection
         {
             object[] parameters = new object[] { propertyName, dataType, propertyValue };
             //All the dao objects implements a interface with CreateProperty method. But all of them are diferent interfaces: there isn't a common interface
             //Calling InvokeMember we can do a generic code to call CreateProperty of al the objects
             Properties.Append((dao.Property)(DaoObject.GetType().InvokeMember("CreateProperty", System.Reflection.BindingFlags.InvokeMethod, null, DaoObject, parameters)));
         }
         else if (ex.ErrorCode == -2146825287)       //Argument not valid
         //Can't add a property: This will occur with CollatingOrderProperty
         //Other properties are excluded from DatabaseDao.gatherProperties method
         {
         }
         else
         {
             throw;
         }
     }
 }
Beispiel #5
0
 public DataEntity(List <DataProperty> props) : this()
 {
     _AddBlank();
     Properties = Properties.Append(props);
 }