Showing duplication of data

Posted by: damian.haynes on 9 December 2020, 12:36 pm EST

    • Post Options:
    • Link

    Posted 9 December 2020, 12:36 pm EST

    Hi there, If we want to output the exact datatable, that may contain duplicate records - how do we do that? it currently removes duplicates.

    Test case - two columns, two rows are duplicate values but one is filtered out.

            // Fields
            var dataTable = new DataTable("Grid1");
            dataTable.Columns.Add(new DataColumn("Column1", typeof(string)));
            dataTable.Columns.Add(new DataColumn("Column2", typeof(string)));
    
            dataTable.Rows.Add("1", "Bob");
            dataTable.Rows.Add("1", "Bob");
            dataTable.Rows.Add("2", "Tom");
            dataTable.Rows.Add("3", "Jerry");
    
            var ds = new DataSet();
            ds.Tables.Add(dataTable);
    
            // Excel
            Workbook workbook = new Workbook();
            workbook.Open(templateFileLocation);
    
            //Add data source
            workbook.AddDataSource("grids", ds);
    
            //Invoke to process the template
            workbook.ProcessTemplate();
    

    Thanks,

    Damian.

  • Posted 9 December 2020, 4:12 pm EST

    Hi,

    We too can observe this behavior and escalated this to the developers. We will let you know once we get any update on this from the developers’ end.

    [Internal Tracking ID: 3465]

    Regards,

    Prabhat Sharma.

  • Posted 10 December 2020, 8:31 am EST

    OK, thanks, this is a blocker for us to proceed at the moment.

  • Posted 10 December 2020, 1:05 pm EST

    Hi,

    Our developers are working on this and it will get fixed soon.

    Regards,

    Prabhat Sharma.

  • Posted 13 December 2020, 12:43 am EST

    Hi,

    The issue has been fixed in an internal build and it will be available in the next release.

    Regards,

    Prabhat Sharma.

  • Posted 13 December 2020, 8:02 am EST

    OK thanks, great news, when will this next release be?

  • Posted 13 December 2020, 1:07 pm EST

    Hi there,

    Another interesting one is where you add Column names as a first row, they come out last… like it is sorted or something?

            dataTable.Rows.Add("Column1", "Column2");
            dataTable.Rows.Add("0", "Larry");
            dataTable.Rows.Add("1", "Bob");
            dataTable.Rows.Add("1", "Bob");
            dataTable.Rows.Add("2", "Tom");
            dataTable.Rows.Add("3", "Jerry");
    

    Column1 and Column2 are now at the last record once processed.

    thanks,

    Damian.

  • Posted 15 December 2020, 4:16 pm EST

    Hi Damian,

    >>Another interesting one is where you add Column names as a first row, they come out last… like it is sorted or something?

    This issue has been replied on the below-given link, please continue the thread there only:

    https://www.grapecity.com/forums/documents-excel/column-headers-as-a-row-ap

    >>Hi there, If we want to output the exact datatable, that may contain duplicate records - how do we do that? it currently removes duplicates.

    As per the developers, this is a designed behavior of the GcExcel Template.

    There is a property “G(group)” on the template cell, with values: M(merge), N(normal), R(repeat), and L(list).

    By default, a template cell has a “G(group)” property with the value “M(merge)”, which means GcExcel will try to group and merge the duplicate records.

    Other values “N(normal)” and “R(repeat)” will do the same group only with different text performance.

    The value “L(list)” means GcExcel will not group the records, and just list the data items.

    So, for this case, you only need to modify the template cell from “ds.Category” to “ds.Category(G=L)”.

    The related demo: https://www.grapecity.com/documents-api-excel/demos/setgrouptype

    Regards,

    Prabhat Sharma.

  • Posted 16 December 2020, 7:50 am EST

    awesome, thanks for the explanation!

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels