Add a dynamic date to file name

Stimulsoft Reports.NET discussion
Post Reply
Bisoux
Posts: 16
Joined: Wed Jul 08, 2020 12:30 pm

Add a dynamic date to file name

Post by Bisoux »

Hi everyone,

I have a requirement where i need to dynamically add a date field to the filename at the time of export.

So the file name should look like "filename 202110". The dynamic part is the year + current month after filename.

The script language on the report is set to CSharp but I can switch that if required.

On the code page of the report i see the following,

Code: Select all

using System;
using System.Drawing;
using System.Windows.Forms;
using System.Data;
using Stimulsoft.Controls;
using Stimulsoft.Base.Drawing;
using Stimulsoft.Report;
using Stimulsoft.Report.Dialogs;
using Stimulsoft.Report.Components;

namespace Reports
{
    public class n10425859SL : Stimulsoft.Report.StiReport
    {
        public n10425859SL()        {
            this.InitializeComponent();
						
        }

        #region StiReport Designer generated code - do not modify
        #endregion StiReport Designer generated code - do not modify
		
	
    }
}

I have seen one post here where the solution suggested was,

Code: Select all

viewer.addEventListener(StiViewerEvent.START_EXPORT, onStaerExport);

... 

private function onRetrieveColumns(event: StiViewerEvent): void
{
    event.report.reportFile = event.report.reportName + StiDateTime.now.toString("YYYY-MM-dd");
}
I tried to implement this but i am not getting the required result. Can you please share sample mrt files where you have implemented this requirement or direct me to an answer for this that was posted here previously. I am using Stimulsoft Designer Version 2021.3.1, WinFomrs , .NET 4.5

Thank you
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Add a dynamic date to file name

Post by HighAley »

Hello,

It needs some time.
Please, send us a request and we will prepare a report for you.

Thank you.
Bisoux
Posts: 16
Joined: Wed Jul 08, 2020 12:30 pm

Re: Add a dynamic date to file name

Post by Bisoux »

Hello,

If you dont have a report it is fine. If you can tell me where in the code i need to specify the dynamic file name that will also work for me. If it is not possible to have dynamic file names do let me know as well.

Thank you
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Add a dynamic date to file name

Post by HighAley »

Hello,

Please, send us a request and we will send your all necessary information.

Thank you.
Post Reply