AddCustomProperty() public method

Add a custom property to this document. If a custom property already exists with the same name it will be replace. CustomProperty names are case insensitive.
public AddCustomProperty ( CustomProperty cp ) : void
cp CustomProperty The CustomProperty to add to this document.
return void
        public override void MergeField(DocX doc)
        {
            base.MergeField(doc);

            doc.AddCustomProperty(new Novacode.CustomProperty("ProductPart.LabelsPerRoll", this.LabelsPerRoll??0));
            doc.AddCustomProperty(new Novacode.CustomProperty("ProductPart.SoulDiameter", this.SoulDiameter ?? 0));
            doc.AddCustomProperty(new Novacode.CustomProperty("ProductPart.MaxDiameter", this.MaxDiameter ?? 0));
        }
       public virtual void MergeField(DocX doc)
       {
           doc.AddCustomProperty(new Novacode.CustomProperty("PPPA.TypeOfMaterial", this.TypeOfMaterial));
           doc.AddCustomProperty(new Novacode.CustomProperty("PPPA.NameOfMaterial", this.NameOfMaterial));
           doc.AddCustomProperty(new Novacode.CustomProperty("PPPA.Color", this.Color));
           doc.AddCustomProperty(new Novacode.CustomProperty("PPPA.Weight", this.Weight ?? 0));
           doc.AddCustomProperty(new Novacode.CustomProperty("PPPA.Adhesive", this.Adhesive));
 		        
       }
示例#3
0
        public override void MergeField(DocX doc)
        {
            doc.AddCustomProperty(new Novacode.CustomProperty("CustomerBusinessName", this.CustomerSupplier.BusinessName));

            doc.AddCustomProperty(new Novacode.CustomProperty("EstimateNumber", this.EstimateNumber));
            doc.AddCustomProperty(new Novacode.CustomProperty("EstimateNumberSerie", this.EstimateNumberSerie));

            doc.AddCustomProperty(new Novacode.CustomProperty("DocumentName", this.DocumentName));
            doc.AddCustomProperty(new Novacode.CustomProperty("DocumentDate", (this.DateDocument ?? DateTime.Now).ToString("d")));
        }
示例#4
0
 public virtual void MergeField(DocX doc)
 {
     doc.AddCustomProperty(new Novacode.CustomProperty("DocumentTaskCenter.DocumentName", this.DocumentName));
     doc.AddCustomProperty(new Novacode.CustomProperty("DocumentTaskCenter.CodDocumentTaskCenter", this.CodDocumentTaskCenter));
     doc.AddCustomProperty(new Novacode.CustomProperty("DocumentTaskCenter.FieldA", this.FieldA));
     doc.AddCustomProperty(new Novacode.CustomProperty("DocumentTaskCenter.FieldB", this.FieldB));
     doc.AddCustomProperty(new Novacode.CustomProperty("DocumentTaskCenter.FieldC", this.FieldC));
 
 
 
 }
示例#5
0
 private static void FillContent(DocX doc, Type type, object obj){
     foreach (var prop in type.GetProperties())
     {
         doc.AddCustomProperty(new CustomProperty("@" + prop.Name, prop.GetValue(obj,null).ToString()));
     }
 }
示例#6
0
文件: CostEx.cs 项目: algola/backup
 public virtual void MergeField(DocX doc)
 {
     doc.AddCustomProperty(new Novacode.CustomProperty("Cost.Description", this.Description));
     doc.AddCustomProperty(new Novacode.CustomProperty("Cost.Quantity", this.Quantity ?? 0));
     doc.AddCustomProperty(new Novacode.CustomProperty("Cost.UnitCost", this.UnitCost));
     doc.AddCustomProperty(new Novacode.CustomProperty("Cost.TotalCost", this.TotalCost));
     doc.AddCustomProperty(new Novacode.CustomProperty("Cost.Markup", this.Markup ?? 0));
     doc.AddCustomProperty(new Novacode.CustomProperty("Cost.GranTotalCost", this.GranTotalCost));
 }
示例#7
0
        public virtual void MergeField(DocX doc)
        {
            TaskCost.MergeField(doc);

            doc.AddCustomProperty(new Novacode.CustomProperty("CostDetail.Starts", this.Starts ?? 0));
            doc.AddCustomProperty(new Novacode.CustomProperty("CostDetail.GainForRun", this.GainForRun ?? 0));
            doc.AddCustomProperty(new Novacode.CustomProperty("CostDetail.GainForRunForPrintableArticle", this.GainForRunForPrintableArticle ?? 0));
            doc.AddCustomProperty(new Novacode.CustomProperty("CostDetail.GainForMqRun", this.GainForMqRun ?? 0));
            doc.AddCustomProperty(new Novacode.CustomProperty("CostDetail.GainForMqRunForPrintableArticle", this.GainForMqRunForPrintableArticle ?? 0));
            doc.AddCustomProperty(new Novacode.CustomProperty("CostDetail.TypeOfQuantity", this.TypeOfQuantity ?? 0));
            doc.AddCustomProperty(new Novacode.CustomProperty("CostDetail.GainForWeigthRun", this.GainForWeigthRun ?? 0));
            doc.AddCustomProperty(new Novacode.CustomProperty("CostDetail.GainForWeigthRunForPrintableArticle", this.GainForWeigthRunForPrintableArticle ?? 0));
            doc.AddCustomProperty(new Novacode.CustomProperty("CostDetail.Error", this.Error ?? 0));
            doc.AddCustomProperty(new Novacode.CustomProperty("CostDetail.RollChanges", this.RollChanges ?? 0));
            doc.AddCustomProperty(new Novacode.CustomProperty("CostDetail.CalculatedMq", this.CalculatedMq ?? 0));
            doc.AddCustomProperty(new Novacode.CustomProperty("CostDetail.CalculatedMl", this.CalculatedMl ?? 0));
            doc.AddCustomProperty(new Novacode.CustomProperty("CostDetail.CalculatedKg", this.CalculatedKg ?? 0));
            doc.AddCustomProperty(new Novacode.CustomProperty("CostDetail.CalculatedRun", this.CalculatedRun ?? 0));
            doc.AddCustomProperty(new Novacode.CustomProperty("CostDetail.CalculatedTime", (this.CalculatedTime ?? new TimeSpan(0, 0, 0)).ToString()));

            doc.AddCustomProperty(new Novacode.CustomProperty("CostDetail.Implants", this.Implants ?? 0));            

            if (ProductPartPrinting != null)
            {
                TaskexEcutorSelected = TaskExecutors.FirstOrDefault(x => x.CodTaskExecutor == CodTaskExecutorSelected);
                ProductPartPrinting.MergeField(doc);
            }

        }
示例#8
0
        public virtual void MergeField(DocX doc)
        {

            doc.AddCustomProperty(new Novacode.CustomProperty("ProductName", this.ProductName.Replace("@", Environment.NewLine)));

            if (this.Product.ProductRefName != null)
            {
                doc.AddCustomProperty(new Novacode.CustomProperty("ProductRefName", this.Product.ProductRefName.Replace("@", Environment.NewLine)));
            }
            else
            {
                doc.AddCustomProperty(new Novacode.CustomProperty("ProductRefName", ""));
            }

            doc.AddCustomProperty(new Novacode.CustomProperty("Quantity", string.Format("{0:n0}",(this.Quantity ?? 0))));
            doc.AddCustomProperty(new Novacode.CustomProperty("UnitPrice", this.UnitPrice));
            doc.AddCustomProperty(new Novacode.CustomProperty("TotalAmount", this.TotalAmount));

        }
示例#9
0
        // Create an invoice for a factitious company called "The Happy Builder".
        private DocX CompileFromTemplate(DocX template, PapiroMVC.Models.Document d)
        {

            //customer
            var customer = customerSupplierRepository.GetSingle(d.CodCustomer);
            customer = customer ?? new Customer();

            var cbase = customer.CustomerSupplierBases.Where(x => x.TypeOfBase.CodTypeOfBase == "0001").FirstOrDefault();

            //se non c'è una sede
            cbase = cbase ?? new CustomerSupplierBase();

            #region Set CustomProperty values
            // Set the value of the custom property 'company_name'.
            template.AddCustomProperty(new Novacode.CustomProperty("company_name", customer.BusinessName));

            // Set the value of the custom property 'company_slogan'.
            template.AddCustomProperty(new Novacode.CustomProperty("company_slogan", ""));

            // Set the value of the custom properties 'hired_company_address_line_one', 'hired_company_address_line_two' and 'hired_company_address_line_three'.
            template.AddCustomProperty(new Novacode.CustomProperty("hired_company_address_line_one", cbase.Address ?? ""));
            template.AddCustomProperty(new Novacode.CustomProperty("hired_company_address_line_two", (cbase.PostalCode ?? "") + " " + (cbase.City ?? "") + " " + (cbase.Province ?? "")));
            template.AddCustomProperty(new Novacode.CustomProperty("hired_company_address_line_three", (cbase.Phone ?? "")));

            // Set the value of the custom property 'invoice_date'.
            template.AddCustomProperty(new Novacode.CustomProperty("invoice_date", d.DateDocument.Value.ToString("d")));

            // Set the value of the custom property 'invoice_number'.
            template.AddCustomProperty(new Novacode.CustomProperty("invoice_number", d.Number.ToString()));

            // Set the value of the custom property 'hired_company_details_line_one' and 'hired_company_details_line_two'.
            template.AddCustomProperty(new Novacode.CustomProperty("hired_company_details_line_one", "Business Street, Dublin, 12345"));
            template.AddCustomProperty(new Novacode.CustomProperty("hired_company_details_line_two", "Phone: 012-345-6789, Fax: 012-345-6789, e-mail: [email protected]"));
            #endregion


            /* 
             * InvoiceTemplate.docx contains a blank Table, 
             * we want to replace this with a new Table that
             * contains all of our invoice data.
             */
            Novacode.Table t = template.Tables[1];
            Novacode.Table invoice_table = CreateAndInsertInvoiceTableAfter(t, ref template, d);
            t.Remove();

            // Return the template now that it has been modified to hold all of our custom data.
            return template;
        }
示例#10
0
        public virtual void MergeField(DocX doc)
        {

            //cerco di capire se la macchina èflexo... se è flexo voglio stampare lo zeta e lo h
            if (CostDetail.TaskexEcutorSelected.TypeOfExecutor == TaskExecutor.ExecutorType.Flexo)
            {
                var z = ((Flexo)CostDetail.TaskexEcutorSelected).GetZFromCm(PrintingFormat.GetSide2());
                var pFtoFlexo = "h" + PrintingFormat.GetSide1() + " z" + z.ToString();
                doc.AddCustomProperty(new Novacode.CustomProperty("PPP.PrintingFormat", pFtoFlexo));
            }
            else
            {
                doc.AddCustomProperty(new Novacode.CustomProperty("PPP.PrintingFormat", this.PrintingFormat));
            }

            doc.AddCustomProperty(new Novacode.CustomProperty("PPP.DCut1", this.CalculatedDCut1));
            doc.AddCustomProperty(new Novacode.CustomProperty("PPP.DCut2", this.CalculatedDCut2));
            doc.AddCustomProperty(new Novacode.CustomProperty("PPP.Gain1", this.CalculatedSide1Gain));
            doc.AddCustomProperty(new Novacode.CustomProperty("PPP.Gain2", this.CalculatedSide2Gain));


            if (Part != null)
            {
                doc.AddCustomProperty(new Novacode.CustomProperty("PPP.FormatOpened", this.Part.FormatOpened));
                doc.AddCustomProperty(new Novacode.CustomProperty("PPP.Format", this.Part.Format));
            }
            else
            {
                doc.AddCustomProperty(new Novacode.CustomProperty("PPP.FormatOpened", ""));
                doc.AddCustomProperty(new Novacode.CustomProperty("PPP.Format", this.Part.Format));
            }


        }
示例#11
0
 public virtual void MergeField(DocX doc)
 {
     doc.AddCustomProperty(new Novacode.CustomProperty("CodTaskCenter", this.CodTaskCenter));
     doc.AddCustomProperty(new Novacode.CustomProperty("TaskCenterName", this.TaskCenterName));
 }
示例#12
0
 public override void MergeField(DocX doc)
 {
     doc.AddCustomProperty(new Novacode.CustomProperty("Product.Format", this.Format));
 }
示例#13
0
 public virtual void MergeField(DocX doc)
 {
     doc.AddCustomProperty(new Novacode.CustomProperty("Product.CodProduct", this.CodProduct));
     doc.AddCustomProperty(new Novacode.CustomProperty("Product.ProductName", this.ProductName.Replace("@", Environment.NewLine)));
     doc.AddCustomProperty(new Novacode.CustomProperty("Product.ProductRefName", this.ProductRefName));
     doc.AddCustomProperty(new Novacode.CustomProperty("CodProduct", this.CodProduct));
     doc.AddCustomProperty(new Novacode.CustomProperty("ProductName", this.ProductName.Replace("@", Environment.NewLine)));
     doc.AddCustomProperty(new Novacode.CustomProperty("ProductRefName", this.ProductRefName));
     //doc.AddCustomProperty(new Novacode.CustomProperty("Product.Format", "ciao"));
 }
示例#14
0
        public override void MergeField(DocX doc)
        {
            base.MergeField(doc);

            var description = String.Empty;
            if (TypeOfRepass == 0)
            {
                List<ProductPartSerigraphyOption> optSeris = new List<ProductPartSerigraphyOption>();
                //serigraphy options where we can find the inks and types
                foreach (var item in this.TaskCost.ProductPartTask.ProductPartTaskOptions.OfType<ProductPartSerigraphyOption>())
                {
                    description += item.TypeOfTaskSerigraphy + " " + item.InkSerigraphy + "\n";
                }

            }
            else
            {
                List<ProductPartHotPrintingOption> optSeris = new List<ProductPartHotPrintingOption>();
                //serigraphy options where we can find the inks and types
                foreach (var item in this.TaskCost.ProductPartTask.ProductPartTaskOptions.OfType<ProductPartHotPrintingOption>())
                {
                    description += item.Foil + " " + item.Format + "\n";
                }

            }

            doc.AddCustomProperty(new Novacode.CustomProperty("CostDetail.OptionTask", description));
            doc.AddCustomProperty(new Novacode.CustomProperty("PPP.PrintingFormat", this.WorkingFormat));

        }
示例#15
0
        //public double DCut1Calc
        //{ get; set; }

        //public double DCut2Calc
        //{ get; set; }


        public virtual void MergeField(DocX doc)
        {
            doc.AddCustomProperty(new Novacode.CustomProperty("ProductPart.ProductPartName", this.ProductPartName));
            doc.AddCustomProperty(new Novacode.CustomProperty("ProductPart.Format", this.Format));
            doc.AddCustomProperty(new Novacode.CustomProperty("ProductPart.ServicesNumber", this.ServicesNumber ?? 0));
            doc.AddCustomProperty(new Novacode.CustomProperty("ProductPart.FormatOpened", this.FormatOpened));
            doc.AddCustomProperty(new Novacode.CustomProperty("ProductPart.SubjectNumber", this.SubjectNumber ?? 0));
            doc.AddCustomProperty(new Novacode.CustomProperty("ProductPart.DCut", this.DCut ?? 0));
            doc.AddCustomProperty(new Novacode.CustomProperty("ProductPart.IsDCut", this.IsDCut ?? false));
            doc.AddCustomProperty(new Novacode.CustomProperty("ProductPart.DCut1", this.DCut1 ?? 0));
            doc.AddCustomProperty(new Novacode.CustomProperty("ProductPart.DCut2", this.DCut2 ?? 0));
            doc.AddCustomProperty(new Novacode.CustomProperty("ProductPart.HaveDCutLimit", this.HaveDCutLimit ?? false));
            doc.AddCustomProperty(new Novacode.CustomProperty("ProductPart.MaxDCut", this.MaxDCut ?? 0));
            doc.AddCustomProperty(new Novacode.CustomProperty("ProductPart.MinDCut", this.MinDCut ?? 0));
        }
示例#16
0
        // Create an invoice for a factitious company called "The Happy Builder".
        private static DocX CreateInvoiceFromTemplate(DocX template)
        {
            #region Logo
            // A quick glance at the template shows us that the logo Paragraph is in row zero cell 1.
            Paragraph logo_paragraph = template.Tables[0].Rows[0].Cells[1].Paragraphs[0];
            // Remove the template Picture that is in this Paragraph.
            logo_paragraph.Pictures[0].Remove();

            // Add the Happy Builders logo to this document.
            RelativeDirectory rd = new RelativeDirectory(); // prepares the files for testing
            rd.Up(2);
            Image logo = template.AddImage(rd.Path + @"\images\logo_the_happy_builder.png");

            // Insert the Happy Builders logo into this Paragraph.
            logo_paragraph.InsertPicture(logo.CreatePicture());
            #endregion

            #region Set CustomProperty values
            // Set the value of the custom property 'company_name'.
            template.AddCustomProperty(new CustomProperty("company_name", "The Happy Builder"));

            // Set the value of the custom property 'company_slogan'.
            template.AddCustomProperty(new CustomProperty("company_slogan", "No job too small"));

            // Set the value of the custom properties 'hired_company_address_line_one', 'hired_company_address_line_two' and 'hired_company_address_line_three'.
            template.AddCustomProperty(new CustomProperty("hired_company_address_line_one", "The Crooked House,"));
            template.AddCustomProperty(new CustomProperty("hired_company_address_line_two", "Dublin,"));
            template.AddCustomProperty(new CustomProperty("hired_company_address_line_three", "12345"));

            // Set the value of the custom property 'invoice_date'.
            template.AddCustomProperty(new CustomProperty("invoice_date", DateTime.Today.Date.ToString("d")));

            // Set the value of the custom property 'invoice_number'.
            template.AddCustomProperty(new CustomProperty("invoice_number", 1));

            // Set the value of the custom property 'hired_company_details_line_one' and 'hired_company_details_line_two'.
            template.AddCustomProperty(new CustomProperty("hired_company_details_line_one", "Business Street, Dublin, 12345"));
            template.AddCustomProperty(new CustomProperty("hired_company_details_line_two", "Phone: 012-345-6789, Fax: 012-345-6789, e-mail: [email protected]"));
            #endregion

            /*
             * InvoiceTemplate.docx contains a blank Table,
             * we want to replace this with a new Table that
             * contains all of our invoice data.
             */
            Table t = template.Tables[1];
            Table invoice_table = CreateAndInsertInvoiceTableAfter(t, ref template);
            t.Remove();

            // Return the template now that it has been modified to hold all of our custom data.
            return template;
        }
示例#17
0
 public override void MergeField(DocX doc)
 {
     doc.AddCustomProperty(new Novacode.CustomProperty("RawCut", this.RawCut??false));
 }
        public override void MergeField(DocX doc)
        {
            base.MergeField(doc);

            doc.AddCustomProperty(new Novacode.CustomProperty("ProductPart.FormatA", this.FormatA));
            doc.AddCustomProperty(new Novacode.CustomProperty("ProductPart.FormatB", this.FormatB));
        }