Filter Options

From Apache OpenOffice Wiki
< Documentation‎ | DevGuide
Revision as of 13:05, 15 February 2008 by Ccornell (Talk | contribs)

Jump to: navigation, search



Loading and saving OpenOffice.org API documents is described in Handling Documents. This section lists all the filter names for spreadsheet documents and describes the filter options for text file import.

The filter name and options are passed on loading or saving a document in a sequence of com.sun.star.beans.PropertyValues. The property FilterName contains the name and the property FilterOptions contains the filter options.

Template:Documentation/Note

The list of filter names (the last two columns show the possible directions of the filters):

Filter name Description Import Export
StarOffice XML (Calc) Standard XML filter
calc_StarOffice_XML_Calc_Template XML filter for templates
StarCalc 5.0 The binary format of StarOffice Calc 5.x
StarCalc 5.0 Vorlage/Template StarOffice Calc 5.x templates
StarCalc 4.0 The binary format of StarCalc 4.x
StarCalc 4.0 Vorlage/Template StarCalc 4.x templates
StarCalc 3.0 The binary format of StarCalc 3.x
StarCalc 3.0 Vorlage/Template StarCalc 3.x templates
HTML (StarCalc) HTML filter
calc_HTML_WebQuery HTML filter for external data queries
MS Excel 97 Microsoft Excel 97/2000/XP
MS Excel 97 Vorlage/Template Microsoft Excel 97/2000/XP templates
MS Excel 95 Microsoft Excel 5.0/95
MS Excel 5.0/95 Different name for the same filter
MS Excel 95 Vorlage/Template Microsoft Excel 5.0/95 templates
MS Excel 5.0/95 Vorlage/Template Different name for the same filter
MS Excel 4.0 Microsoft Excel 2.1/3.0/4.0
MS Excel 4.0 Vorlage/Template Microsoft Excel 2.1/3.0/4.0 templates
Lotus Lotus 1-2-3
Text - txt - csv (StarCalc) Comma separated values
Rich Text Format (StarCalc)
dBase
SYLK Symbolic Link
DIF Data Interchange Format

Filter Options for Lotus, dBase and DIF Filters

These filters accept a string containing the numerical index of the used character set for single-byte characters, that is, 0 for the system character set.

Filter Options for the CSV Filter

This filter accepts an option string containing five tokens, separated by commas. The following table shows an example string for a file with four columns of type date - number - number - number. In the table the tokens are numbered from (1) to (5). Each token is explained below.

Example Filter Options String Field Separator (1) Text Delimiter (2) Character Set (3) Number of First Line (4) Cell Format Codes for the four Columns (5)
Column Code
File Format:

Four columns date-num-num-num

, " System line no. 1 1

2
3
4

YY/MM/DD = 5

Standard = 1
Standard = 1
Standard = 1

Token 44 34 0 1 1/5/2/1/3/1/4/1

For the filter options above, set the PropertyValue FilterOptions in the load arguments to "44,34,0,1,1/5/2/1/3/1/4/1". There are a number of possible settings for the five tokens.

  1. Field separator(s) as ASCII values. Multiple values are separated by the slash sign ("/"), that is, if the values are separated by semicolons and horizontal tabulators, the token would be 59/9. To treat several consecutive separators as one, the four letters /MRG have to be appended to the token. If the file contains fixed width fields, the three letters FIX are used.
  2. The text delimiter as ASCII value, that is, 34 for double quotes and 39 for single quotes.
  3. The character set used in the file as described above.
  4. Number of the first line to convert. The first line in the file has the number 1.
  5. Cell format of the columns. The content of this token depends on the value of the first token.
  • If value separators are used, the form of this token is column/format[/column/format/...] where column is the number of the column, with 1 being the leftmost column. The format is explained below.
  • If the first token is FIX it has the form start/format[/start/format/...], where start is the number of the first character for this field, with 0 being the leftmost character in a line. The format is explained below.
Format specifies which cell format should be used for a field during import:
Format Code Meaning
1 Standard
2 Text
3 MM/DD/YY
4 DD/MM/YY
5 YY/MM/DD
6 -
7 -
8 -
9 ignore field (do not import)
10 US-English
The type code 10 indicates that the content of a field is US-English. This is useful if a field contains decimal numbers that are formatted according to the US system (using "." as decimal separator and "," as thousands separator). Using 10 as a format specifier for this field tells OpenOffice.org API to correctly interpret its numerical content, even if the decimal and thousands separator in the current language are different.
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools