1

I am creating Java desktop application. I am using DynamicReports API to create report.

The report was viewed in a JasperViewer. When I click save button, I want to display a name for report to save by default. How to set name for the report by default?

Petter Friberg
  • 19,652
  • 9
  • 51
  • 94
Siddhu
  • 107
  • 1
  • 8
  • You can read [Specifying default file name in JasperViewer](http://jasperforge.org/plugins/espforum/view.php?group_id=83&forumid=101&topicid=56803) post on [jasperforge.org](http://jasperforge.org) – Alex K Aug 22 '12 at 11:24

2 Answers2

0

it is necessary to import the package com.jasperassistant.designer.viewer.ViewerComposite so on that viewer composite you can see a save icon on you left top corner. you can provide any name and location where you want to save. i think that the good way of saving report through your jasper report.

Dinup Kandel
  • 2,389
  • 4
  • 19
  • 36
  • 1
    i think you misunderstand my question.sorry for my english. i already have save option in the top left corner and it works properly but i want a default name for the report in the filename field in the save window.actually the filename field was empty and file format was "JRPrint" by default. i want to change this default value. how to do that? – Siddhu Aug 22 '12 at 07:51
0

Then i think that you have to change in JFileChooser instead of looking into API. You can give default name to be displayed.

This way the approach would be:

JFileChooser jFileChooser = new JFileChooser();
jFileChooser.setSelectedFile(new File("fileToSave.txt"));
jFileChooser.showSaveDialog(parent);

And If you pass a File with an absolute path, JFileChooser will try to position itself in that directory (if it exists).

I got this source from following place

Community
  • 1
  • 1