Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Wed May 23, 2018 11:09 pm

I would like more information about Marker Designers. I have read the information at Marker-Designer . html, but I need a bit more information for some work I am doing.

Is there a list of all of the parameters that may be used with the marker designers? In the example, I see (add:styles) and (horizontal), but not sure if there are others.

Can anyone provide a more complete example of a template worksheet? Possibly an invoice? I have a case where I need to create a document that has data from multiple tables in a master / detail relationship where the master information will be at the top and detail at bottom.

Also, it seems like each item in a datarow causes the entire row to be moved down. Is it possible to move down only the rows in certain columns, thus allowing more than one table to be created from two different sources, side by side?

Thanks for any info,

Jim

jsimmermon
 
Posts: 4
Joined: Wed May 23, 2018 10:56 pm

Thu May 24, 2018 7:50 am

Dear Jim,

Thanks for your inquiry.
1. About other parameters, we will look into it and then update you.
2. I have attached sample file which has multiple tables, and here is my code, it could help you understand the function.
Code: Select all
        public static void Test()
        {
                var wb = new Workbook();
                wb.LoadFromFile(@"sample .xlsx", ExcelVersion.Version2010);

                //only one cell has the parameter
                wb.MarkerDesigner.AddParameter("Description", "description");
                //add data to the table "Prod"
                wb.MarkerDesigner.AddDataTable("Prod", getProductRequirment());
                wb.MarkerDesigner.AddDataTable("Ord", getOrd1());
                wb.MarkerDesigner.AddDataTable("Ord2", getOrd2());
                wb.MarkerDesigner.Apply();

                wb.SaveToFile(@"output.xlsx", ExcelVersion.Version2010);
                System.Diagnostics.Process.Start("marker13936-new.xlsx");
        }
        private static DataTable getOrd1()
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("Description", typeof(string));
            dt.Columns.Add("Qty", typeof(string));
            dt.Columns.Add("UnitPrice", typeof(string));
            dt.Columns.Add("Discount", typeof(string));
            dt.Columns.Add("Amount", typeof(string));

            dt.Rows.Add(getSubstratesRow("TEST1", "TEST2", "TEST3", "TEST4", "TEST5", dt));
            dt.Rows.Add(getSubstratesRow("TEST1", "TEST2", "TEST3", "TEST4", "TEST5", dt));
            return dt;
        }
        private static DataRow getSubstratesRow(string description, string Qty, string UnitPrice, string Discount, string Amount, DataTable dt)
        {
            DataRow dr = dt.NewRow();
            dr["Description"] = description;
            dr["Qty"] = Qty;
            dr["UnitPrice"] = UnitPrice;
            dr["Discount"] = Discount;
            dr["Amount"] = Amount;
            return dr;
        }
        private static DataTable getOrd2()
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("Description", typeof(string));
            dt.Columns.Add("Qty", typeof(string));
            dt.Columns.Add("UnitPrice", typeof(string));
            dt.Columns.Add("Discount", typeof(string));
            dt.Columns.Add("Amount", typeof(string));
            dt.Rows.Add(getSubstratesRow("Description", "Qty", "UnitPrice", "Discount", "Amount", dt));
            return dt;
        }
        private static DataTable getProductRequirment()
        {
            DataTable dt = new DataTable();
            dt.Columns.Add("Characteristics", typeof(string));
            dt.Columns.Add("Value", typeof(string));
            dt.Rows.Add(getDataRow("TEST", "Product1", dt));
            dt.Rows.Add(getDataRow("TEST", "Product2", dt));
            dt.Rows.Add(getDataRow("TEST", "Product3", dt));
            return dt;
        }
        private static DataRow getDataRow(string pr, string value, DataTable dt)
        {
            DataRow dr = dt.NewRow();
            dr["Characteristics"] = pr;
            dr["Value"] = value;
            return dr;
        }

Any question, just feel free to contact us.

Sincerely,
Betsy
E-iceblue support team
Attachments
SampleFiles.zip
(15.03 KiB) Downloaded 280 times
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Thu May 24, 2018 3:45 pm

Thank you very much. I would very much like to know what parameters are available whenever you get a chance, but this sample will help quite a bit.

jsimmermon
 
Posts: 4
Joined: Wed May 23, 2018 10:56 pm

Fri May 25, 2018 1:27 am

Dear jsimmermon ,

We will keep you informed if there is any update.
Have a nice day.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Tue May 29, 2018 6:47 pm

I'm actually having more issues. I want to have a sum of the numbers in the table after the fields are added. When I try to sum a row, it gets overwritten. Some other formulas do not calculate unless I enter into the field and press return.


Can you tell me what I'm doing wrong, here? I would very much like to use this tool. I am attaching my project in hopes that it helps in understanding what I"m trying to accomplish.
Attachments
proof.zip
(27.81 KiB) Downloaded 261 times

jsimmermon
 
Posts: 4
Joined: Wed May 23, 2018 10:56 pm

Wed May 30, 2018 2:52 am

Dear jsimmermon,

Thanks for your inquiry.
1. As for the overwritten issue, it is because your template document lacks of the string "add:styles" after the first field. I have attached changed template.

2. For the calculation issue, please add the code "templateWorkbook.CalculateAllValue();" before saving the workbook. Besides, I found the cell "B13" and "B19" has a formula "=_xlfn.CONCAT("TOTAL: ",E17)" which is not recognized/standard in Excel, please have a check.

3. About the parameters, we finished the investigation, they are "add:styles" , "horizontal", "skip:r[number]c[number]" which will skip the value according to the number of row and column.
Here is the testing code:
Code: Select all
                Workbook workbook = new Workbook();
                //workbook.LoadFromFile(@"F:\horizontal.xlsx");
                workbook.LoadFromFile(@"F:\skip.xlsx");
                DataTable dt = new DataTable();
                dt.TableName = "Country";
                dt.Columns.Add("Name");
                dt.Columns.Add("Capital");
                dt.Columns.Add("Continent");
                dt.Columns.Add("Area");
                dt.Columns.Add("Population");
                dt.Rows.Add("a", "a", "11", "test", 7200);
                dt.Rows.Add("b", "b", "1", "test", 5600);
                dt.Rows.Add("c", "c", "1", "test", 12600);
                dt.Rows.Add("d", "d", "1", "test", 51000);
                Worksheet sheet = workbook.Worksheets[0];
                workbook.MarkerDesigner.AddDataTable("Country", dt);
                workbook.MarkerDesigner.Apply();       
                workbook.CalculateAllValue();
                workbook.SaveToFile("skip-result.xlsx");

I attached related files for your your kind reference.
Any question, just feel free to contact us.

Sincerely,
Betsy
E-iceblue support team
Attachments
ParameterSample.zip
parameter sample file
(31.24 KiB) Downloaded 271 times
Files.zip
Changed template
(15.68 KiB) Downloaded 292 times
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Fri Jun 01, 2018 1:25 am

Dear jsimmermon,

Hope you are doing well.
Has your issue been resolved ? Your feedback would be greatly appreciated.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.XLS