[ Master documentation index ]
Introduction
The export and printing capabilities are used to transfer information
from DbVisualizer primarily to files and printers. Both functions are
based on what's in the current context and adapt the configuration
possibilities accordingly. Data in the following contexts (components)
can be exported:
These contexts can be printed:
Please read more in the Getting
Started and General Overview document for information about these
components.
Printing of charts is currently not supported. Instead we recommend
that you first export the chart and then use your favorite printing
tool to get it on paper (a standard web browser is sufficient). The Print Preview operation can only be
used for grid data.
There are major differences between DbVisualizer Free and Personal when
exporting grid data. This document explains the complete functionality
in the Personal edition even though it implicitly covers the export
functionality in DbVisualizer Free.
The functionality for Export of Graphs and Charts and Printing of
Graphs and Grids is the same in both editions.
Export
The export functionality is used to export data that has been fetched
and presented in DbVisualizer to another source. The export dialog looks
different depending on whether a grid, graph or chart data is going to be
exported. The following sections describe the settings that can be
made in each of these contexts.
How to launch
Export is primarily initiated using the File->Export
main menu choice. This operation examines the current context and
displays the appropriate dialog. The File->Export
Selection main menu choice is specifically for Grid contexts and is used to export
the current selection instead of all data in the grid. It is only
enabled if the current context is a grid and if there are any selected
cells in it. In addition all grids throughout DbVisualizer offer the
right click menu choice for Export
Selection. It is simply a shortcut for the File->Export Selection main menu
operation.
Note: Export Selection will
only include the selected columns in the Export window (i.e in the
Columns list).
Grid data
There are a range of options to configure the exported data for grids.
This is how the window is organized:

Figure: The
Export window for grid data
Please see the sections below for detailed information on each field and what
settings
that can be made.
Destination
The destination field specifies the target destination for the exported
data.
Destination
|
Description
|
Clipboard
|
Export
to the (system) clipboard is convenient if you want to use the exported
data in another application without the extra step of exporting to file
first. Data can even be pasted into a spreadsheet application such as
Excel or StarOffice and the cells in the grid will appear as cells in
the spreadsheet. Read more about the CSV format in the Format section.
|
SQL
Commander
|
This option is only enabled if
exporting in the SQL format. It simply transfers the export data (as
SQL INSERT statements) to the SQL Commander editor. The SQL
Commander can then be used to execute the script of statements.
|
File
|
This option outputs the data to
a named file.
|
Format
Grid data can be exported in the following formats.
Format
|
Description
|
HTML
|
The
data is exported in HTML format using the <TABLE> and associated
tags.
|
XML
|
The XML format is handy when
importing or using the exported data in an XML enabled application. The
structure of the XML format is:
<ROWSET>
<ROW>
<Column1>5</Column1>
<Column2>Hepp</Column2>
<Column3>59248</Column3>
</ROW>
<ROW>
<Column1>15</Column1>
<Column2>Hopp</Column2>
<Column3>41993</Column3>
</ROW>
<ROW>
<Column1>15</Column1>
<Column2>Hupp</Column2>
<Column3>44115</Column3>
</ROW>
</ROWSET>
|
SQL
|
The SQL format simply creates an
SQL INSERT statement for each row in the grid. It also uses the
column names from the grid to define the column clause in the SQL
statement.
insert into table1
(Column1, Column2, Column3) values (5, 'Hepp', 59248);
insert into table1
(Column1, Column2, Column3) values (15, 'Hopp', 41993);
insert into table1
(Column1, Column2, Column3) values (16, 'Hupp', 44115);
|
CSV
|
The CSV format (Character
Separated Values) is used to export the grid of data to a file in which
each column is separated with a character or several. It is even
possible to specify the row delimiter (aka newline sequence of
characters).
5,Hepp,59248
15,Hopp,41993
16,Hupp,44115
The above example use a "," as the column delimiter and a
"\n" sequence as the row delimiter (invisible above).
|
Columns
The columns list is used to control what columns will be exported
and the format of their data. The list is exactly the same as the
column headers in the
original grid i.e. if a column was manually removed from the grid
before launching export then it will not appear in this list. The Table Name field may list the name
of the actual database table if it is known at the time when the export
dialog is displayed. The Rows
field lists the number of rows that are going to be exported.
Field
|
Description
|
Export
|
Defines
whether the column will be exported or not. Uncheck it to ignore the
column in the exported output.
|
Name
|
The name of the column. This is
only used if exporting in HTML, XML or SQL format. Column headers are optional
in the CSV output format.
|
Type
|
The internal DbVisualizer type
for the column. This type is used to determine if the column is a text
column (i.e if the data will be surrounded in quotes or not).
|
Text
|
Specifies if the column is
considered to be a text column (this is determined based on the type)
and so if the value will be enclosed in quotes.
|
Value
|
The default "$$value$$" variable will simply
be substituted by the actual value in the exported output. You can
enter additional static text in the value field. This is also the place
where any test data generators are
defined.
|
Options
The options tabs are used to manipulate a range of settings that are
used to control the output.
Format
The format settings control the appearance of date, time, the textual
representation of null and whether numbers will include a thousands
separator in the exported output.

Figure: The Format settings
Text
The text settings control whether text data will be enclosed by
single, double or no quotes. A text column is defined by checking the Text column in the Columns list. All other columns will
be exported without any quotes.

Figure: The Text settings
Delimiter
The delimiter settings specify the column delimiter character(s) and
the newline character sequence for CSV output format. These settings
are used independently if exporting to file or any of the other destinations.

Figure: The
Delimiter settings
The \ character indicates that an encoded
character will follow. The following escaped characters can be used in
the column delimiter and the newline identifier:
Sequence
|
Description
|
\n
|
New line
|
\r
|
Carriage Return
|
\t
|
Tab
|
Exporting to file in different OS'es and exporting to clipboard for
later inclusion in other applications requires different settings of
both the column delimiter and the newline identifier. The following
lists the most common situations:
Export
Destination
|
Target
OS/Application
|
Column
Delimiter
|
Newline
Identifier
|
File
|
Windows
|
any
|
\r\n
|
Unix/Linux
|
any
|
\n
|
Clipboard
|
Paste into Microsoft Excel
|
\t
|
\n
|
Paste into StarOffice/OpenOffice
SpreadSheet
|
\t
|
\n or \r\n
|
Extra
The extra settings are used to specify if the original SQL command and
the column names will appear in the exported output.
The SQL Command setting is
only enabled if the actual SQL command that produced the data in the
grid is known. The Column Names
setting is only valid for use in CSV formats since the column names
are required in the other formats.

Figure: The Extra
settings
Description
The description setting consists of a text field in which informative
text about the data can be entered. This will be in the exported output
for HTML and XML formats only (within a comment block for XML).

Figure: The
Description settings
Generate Test Data
The test data generator is useful when you need to add random column
data to the exported output. The actual value of the data that is going
to be in the exported output is referenced by the $$value$$ variable in the
Columns list. This variable is simply replaced by the real value during
the export process. Additional static data can be added before and
after the $$value$$ field
and will be exported as entered. The value field is also the place to
setup any test data generators. While in the editing mode of the value
field there is a right click menu with the supported generator
functions:
Function
Name
|
Function
Call
|
Example
|
Generate
random number
|
$$var||randomnumber(1,
2147483647)$$
|
Generates a random number
between 1 and 2147483647
|
Generate
random string of random size
|
$$var||randomtext(1,
10)$$
|
Generates random text with a
length between 1 an 10 characters
|
Generate
random value from a list of values
|
$$var||randomenum(v1,
v2, v3, v4, v5)$$
|
Picks one of the listed values
in random order
|
Generate
sequential number
|
$$var||number(1,
2147483647, 1)$$
|
Generates a sequential number
starting from 1. The generator re-starts at 1 when 2147483647 is
reached. The number is increased with 1 every time a new value is
generated.
|
Test data generator
sample
Here follows an example that utilizes the test data generators. Consider
this data:

Figure: Sample of
grid data
The export window will display the following:

Figure:
The export window
In addition to the original columns we want to
remove the CustomerID from the
exported data and add a new column named Id as the first column. This column
will be the new primary key and will be a sequential number starting
at 1000. This is done by
adding the Generate
sequential number function. The list will now look like this:

Figure:
Customized columns list with a generator function
Previewing the data (or exporting it) results in this:
Id,CompanyName,ContactName
1000,Alfreds Futterkiste,Maria Anders
1001,Ana Trujillo Emparedados y helados,Ana
Trujillo
1002,Antonio Moreno Taquería,Antonio
Moreno
1003,Around the Horn,Thomas Hardy
1004,Berglunds snabbköp,Christina Berglund
1005,Blauer See Delikatessen,Hanna Moos
1006,Blondesddsl père et
fils,Frédérique Citeaux
1007,Bólido Comidas
preparadas,Martín Sommer
1008,Bon app',Laurence Lebihan
1009,Bottom-Dollar Markets,Elizabeth Lincoln
1010,B's Beverages,Victoria Ashworth
1011,Cactus Comidas para llevar,Patricio Simpson
1012,Centro comercial Moctezuma,Francisco Chang
1013,Chop-suey Chinese,Yang Wang
1014,Comércio Mineiro,Pedro Afonso
1015,Consolidated Holdings,Elizabeth Brown
1016,Drachenblut Delikatessen,Sven Ottlieb
1017,Du monde entier,Janine Labrune
1018,Eastern Connection,Ann Devon
1019,Ernst Handel,Roland Mendel
1020,Familia Arquibaldo,Aria Cruz
...
Preview
The preview operation is used to check the data before it is exported.
The general recommendation is to use this feature before exporting the
data. Having to re-launch the export window (to do more edits) will
reset the columns list and any manual changes will be lost.
Graph data
Exporting references graphs will export the graph in the same zoom
level as it appears on the screen. The export window when exporting
graphs looks like this:

Figure: Export
window for graphs
The export
window is quite limited as compared to when exporting grids. The graph
can only be exported to a File
in the JPEG or GIF formats.
Export of graphs cannot be previewed.
Chart data
Exporting charts adds the capabilities to set the size and orientation
of the exported file.

Figure: Export
window for charts
A chart can only be exported to a File
in the JPEG and PNG formats. The optional Layout settings are used to control
the size of the image. The initial width and height are the same as the
size of the chart as it appear on the screen. The Size list when clicked shows a list
of well known paper formats. The Width
and Height will be changed to
match the selected size. Setting the width and height or selecting a
pre-defined size will scale the exported image accordingly.
Export of charts
cannot be previewed.
Print
The printing support in DbVisualizer supports printing of Grids and
Graphs. The print dialog looks somewhat different depending on what is
printed.
Grid
Printing a grid in DbVisualizer causes the visual grid to be output on
paper. This includes the table headers, sort and primary key indicator,
etc. It can be output as a screen shot that spans several pages depending
on the number of rows and columns that are printed. The other solution
to printing grids is to export to HTML and then use a web browser to print
it. The choice of which is more attractive than the other is up to
you to decide.

Figure: Standard
print dialog
The content and layout of the print dialog is
platform specific. The above screen shot is from Linux/RedHat.
Graph
The graph printing setup dialog adds a step before the standard
printing dialog is displayed.

Figure: Print
options when printing graphs
It is possible to specify the number of rows (pages)
and columns (pages) that the complete image will be divided into. It is
also possible to select whether the view as it appears on the screen will be
printed or the complete graph.
Print Preview
The File->Print Preview
operation is used to launch a viewer in which a preview of the current
grid is presented.
Note: The Print Preview can
only be used for grid printouts.

Figure: Print
preview window
The print preview supports setting the zoom level.
Copyright © 2004 Minq Software AB. All rights reserved.