There is a random report my company needs to generate and save it to a particular location automatically. Can we do the same with the standard reports in Ax 2009? How can we save it directly to a particular location. I have read multiple posts regarding the same but no luck, they didn’t work for me. Nor can i edit/create classes, so everything has to be on the report methods itself.
Or if we can specify the location in the dialog box and skip the screen report viewer option and directly save the file in XLS or any such format, on to the specified location. Any references ?
Do you mean that u want to open report directly in excel or save that respective report in excel on particular folder (path) OR it will go bydefault user’s mydocument. If yes? then I can help u. Please inform.
Yes, I need that report to be saved on the specified location. (By-default, or via save file dialog).
And it is a standard ax2009 report which should be saved in XLS format.
I’d be glad if you could help me.
You shouldn’t just say “didn’t work for me” - you should fix the problem (unfortunately you didn’t mention what the problem is).
For example, you can call this code in report’s init() method:
Nevertheless XLS is not a supported print format. Either use a supported format, or use another technology (such as SSRS or Create!form).
Got it! I was going wrong. I have put the same code on init() but the report opens in EXCEL format may be that could be the reason it did not work for that particular report.
Yes XLS is not a supported format but I’ve set printformat as HTML and filename as filename.xls
I do not know if that’s valid in this case.
Now with PDF, Its giving me some write -protected issue now.
I have a question , when we specify a the path, say
And when I see the dialog box file location, the path is seen as "C:\mydocuments.somefolderReport.pdf"
Why so ? Could that be the reason for the "write-protected file" or "file in-use" error.
Changing the file extension doesn’t change the format. You’ll simply get an HTML file with .xls extension; there is no magic that would transform the content.
About the problem with file name, it’s now trying to save the file to c:, which may be a protected area. The file name is obviously wrong - are you sure you have the @ sign before the string in your code?
now try this - In the report method -
printHeading = true; // initially the heading will be printed
this.printJobSettings().setTarget(PrintMedium::File); // setting the report output option to “file”
this.printJobSettings().preferredFileFormat(PrintFormat::ASCII); // Print format is set to ASCII
info(“File will create in Documents - Test1.xls”);
- overwrite method - printerSettings()
ret = super(_showWhat);
- overwrite method - setTarget()
ret = super(PrintMedium::File);
check and inform whether is this helpful for u?