Version 2024.4.3 is duplicating items

Stimulsoft Reports.WEB discussion
Post Reply
fghiggi
Posts: 8
Joined: Tue Feb 23, 2021 7:55 pm

Version 2024.4.3 is duplicating items

Post by fghiggi »

When I have a GroupHeader with the condition New Page Before, starting from the second page, items begin to duplicate.
If I use the New Page After condition, this does not happen.

How can I fix this? Is it a bug?

Image

Image


https://gitlab.com/fghiggi/stimulsoft-duplicate-itens#
Attachments
report.mrt
(455 KiB) Downloaded 135 times
duplicated.pdf
(48.5 KiB) Downloaded 140 times
Lech Kulikowski
Posts: 7333
Joined: Tue Mar 20, 2018 5:34 am

Re: Version 2024.4.3 is duplicating items

Post by Lech Kulikowski »

Hello,

Please send test data for your report.

Thank you.
fghiggi
Posts: 8
Joined: Tue Feb 23, 2021 7:55 pm

Re: Version 2024.4.3 is duplicating items

Post by fghiggi »

it is on project linked in original post

https://gitlab.com/fghiggi/stimulsoft-d ... type=heads

Variables:

Code: Select all

        Hashtable ReportVariables = new()
        {
            { "NomeSistema", "Secullum Ponto Web" },
            { "Subtitulo", "TODO" },
            { "Emitido", "Emitido em" },
            { "ContadorPagina", "Página" },
            { "ContadorPaginaDe", "de" },
            { "AvisoCLT", "Sistema regido pela CLT" },
            { "Titulo", "FICHA CADASTRAL" },
            { "Nome", "NOME" },
            { "Idade", "IDADE" },
            { "Email", "EMAIL" },
            { "Celular", "CELULAR" },
            { "Telefone", "TELEFONE" },
            { "Nascimento", "NASCIMENTO" },
            { "TotalFuncionarios", "TOTAL DE FUNCIONARIOS" },
        };
        
        
datatable:

Code: Select all

            void SetDataTable()
            {
                var dataTable = new DataTable();

                dataTable.Columns.Add("PessoaId", typeof(int));
                dataTable.Columns.Add("Linha", typeof(string));
                dataTable.Columns.Add("Contador", typeof(int));

                for (var i = 1; i <= 5; i++)
                {
                    var novaLinha = dataTable.NewRow();

                    novaLinha["PessoaId"] = i;
                    novaLinha["Linha"] = $"teste {i}";
                    novaLinha["Contador"] = dataTable.Rows.Count;

                    dataTable.Rows.Add(novaLinha);

                    report.RegData("datatable", dataTable);
                }

Code: Select all

namespace stimulsoft_duplicate_itens.Controllers
{
    public class HomeController : Controller
    {
        public HomeController() { }

        public IActionResult Index()
        {
            return View();
        }

        public IActionResult ExportPdf()
        {
            var report = GetReport();

            return StiNetCoreReportResponse.ResponseAsPdf(report, saveFileDialog: false);
        }

        private StiReport GetReport()
        {
            var reportPath = StiNetCoreHelper.MapPath(this, "Reports/Report.mrt");
            var report = new StiReport();

            report.Load(reportPath);

            SetVariables();
            SetDataTable();

            return report;

            void SetVariables()
            {
                using var image = Image.FromFile("Images/logotipo.png");

                using var ms = new MemoryStream();
                image.Save(ms, ImageFormat.Jpeg);
                var imageBytes = ms.ToArray();

                var logotipo = StiImageConverter.StringToImage(Convert.ToBase64String(imageBytes));

                report.Dictionary.Variables.Add("LogoEmpresa", logotipo);

                foreach (DictionaryEntry variable in ReportVariables)
                {
                    report.Dictionary.Variables.Add(variable.Key.ToString(), variable.Value);
                }
            }

            void SetDataTable()
            {
                var dataTable = new DataTable();

                dataTable.Columns.Add("PessoaId", typeof(int));
                dataTable.Columns.Add("Linha", typeof(string));
                dataTable.Columns.Add("Contador", typeof(int));

                for (var i = 1; i <= 5; i++)
                {
                    var novaLinha = dataTable.NewRow();

                    novaLinha["PessoaId"] = i;
                    novaLinha["Linha"] = $"teste {i}";
                    novaLinha["Contador"] = dataTable.Rows.Count;

                    dataTable.Rows.Add(novaLinha);

                    report.RegData("datatable", dataTable);
                }
            }
        }


        Hashtable ReportVariables = new()
        {
            { "NomeSistema", "Secullum Ponto Web" },
            { "Subtitulo", "TODO" },
            { "Emitido", "Emitido em" },
            { "ContadorPagina", "Página" },
            { "ContadorPaginaDe", "de" },
            { "AvisoCLT", "Sistema regido pela CLT" },
            { "Titulo", "FICHA CADASTRAL" },
            { "Nome", "NOME" },
            { "Idade", "IDADE" },
            { "Email", "EMAIL" },
            { "Celular", "CELULAR" },
            { "Telefone", "TELEFONE" },
            { "Nascimento", "NASCIMENTO" },
            { "TotalFuncionarios", "TOTAL DE FUNCIONARIOS" },
        };
    }
}
Lech Kulikowski
Posts: 7333
Joined: Tue Mar 20, 2018 5:34 am

Re: Version 2024.4.3 is duplicating items

Post by Lech Kulikowski »

Hello,

We need some additional time to investigate the issue, we will let you know about the result as soon as possible.

Thank you.
Post Reply