Report output to text file

theburnoutheburnou Member Posts: 8
Hi,

I would like to print a navision report to a text file without asking for the file name.

Is it possible ?

It would be great if the file name can be stotred in Navision.

Thanks for your help.

Comments

  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    Do you mean export it to a HTML file?
  • theburnoutheburnou Member Posts: 8
    No, just text file. The aim is to send it to a generic / Text printer after being processed.
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    If the filename is required by the printerdriver then I do not think it is possible. :(

    It is the same as faxing, you cannot give the faxnumber from the customer to the printdriver.

    Unless there is some trick/possibility in the printerdriver. What printerdriver are you using?
  • theburnoutheburnou Member Posts: 8
    I am using a generic / Text driver to be fast because i need to print about 800 pages a day
  • CodeGeniusCodeGenius Member Posts: 40
    Hi theburnou,

    I am not sure if this is helpful. You want to print to a textfile. To my knowledge there is no printer driver that does not ask for a filename.

    Another option is to print to PDF. A PDF printer that does not ask for a filename (if setup correctly) is PDFCreator. (Look for the auto-save options)

    You can download this Printer Driver from: http://sourceforge.net/projects/pdfcreator/

    Hope this helps you.
  • theburnoutheburnou Member Posts: 8
    I found a way to print to a file without being asked for a filename:

    * Add a new printer that prints to the special "File:" port (see question 1).
    * From the printers' panel, right click on the printer you have just added and select Properties.
    * A panel showing the properties for this printer will pop up, click on the Details tab of this panel.
    * Click on the Add Port... button.
    * The Add Port panel will pop up, click on the Other radio button, and make sure Local Port is highlighted, click on OK.
    * A small panel asking for the name of the port will pop up, enter the name of a file in the edit box, for example C:\Output.prn.
    * Click on OK to dismiss the panel asking for the port name.
    * Click on OK to dismiss the printer properties panel.
    * If you now 'print' to this printer the output will be sent directly to C:\Output.prn (or wherever), overwriting what was there before.


    But I need to modify the name of the file for each generated file but not interactively.

    Has any one heard of an ocx by wich the filename can be set as a parameter ?

    Any ideas ?

    Thanks.
  • themavethemave Member Posts: 1,058
    This is a slightly different approach, but you could use a dataport to export the data, and then use access to format the reports. It would be a two step approach, but would certainly work.

    It is easy to get a dataport to create the file name for you on the fly, and even have it created in a specific directory.

    Then set up an access routine to import, format and print your reports.
  • aztecconsultingaztecconsulting Member Posts: 55
    I do a lot of writing to text files, here is some boilerplate code I use:

    First I set the filename, this can come from a field in a table if you like.
    LogFileName :='\\Server\path\path\Sample.Log';

    Now, open the file either for the first time or append to the end.

    //Open files
    IF EXISTS(LogFileName) THEN
    BEGIN
    LogFile.WRITEMODE:=TRUE;
    LogFile.TEXTMODE:=TRUE;
    LogFile.OPEN(LogFileName);
    LogFile.SEEK(LogFile.LEN);
    END
    ELSE
    BEGIN
    LogFile.TEXTMODE:=TRUE;
    LogFile.CREATE(LogFileName);
    END;

    Now at any point I can write to the file.
    LogFile.WRITE( [data to write] );

    Finally, I use this to close the file.
    LogFile.CLOSE;

    This works for me when I need to do special calculations or string concatenation.
Sign In or Register to comment.