File: stf-export.txt

package info (click to toggle)
gnumeric 1.10.8-1squeeze5
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 90,968 kB
  • ctags: 23,303
  • sloc: ansic: 248,235; xml: 51,894; sh: 10,491; makefile: 2,822; perl: 2,466; yacc: 1,272; python: 205
file content (111 lines) | stat: -rw-r--r-- 2,568 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
Gnumeric Structured Text Format (STF) Parser
============================================

by Almer S. Tigelaar

1. Creation/Destruction
2. Customizing the export
	2.1 Terminator Type
	2.2 Cell Separator
	2.3 Quoting mode
	2.4 Quoting char
	2.5 Sheet list
3. Callback routine
4. Exporting

1. Creation/Destruction
=======================
	
	To export a file you first need to create an StfExportOptions_t
	struct, this allows you to customize the export :

		StfExportOptions_t *export_options;

		export_options = stf_export_options_new ();

	After use you must free the struct by calling :

		stf_export_options_free (export_options)


2.1 Terminator Type
===================
	
	The terminator type is the character sequence used to terminate a line, you
	can choose from 3 stock options, namely :

		TERMINATOR_TYPE_LINEFEED           Unix (\n)
		TERMINATOR_TYPE_RETURN             Macintosh (\r)
		TERMINATOR_TYPE_RETURN_LINEFEED    Windows (\r\n)

2.2 Cell Separator
==================

	This is used to separate cells. You can set it to anything you'd like.

	Example :

		This,is,an,example
                    |  |  |
                    -----------------< Cell separator

2.3 Quoting mode
================
	
	This is used to control _when_ to quote. You can choose
	from three stock options, namely :

		QUOTING_MODE_AUTO     Automatically qoute where needed
		QUOTING_MODE_ALWAYS   Always quote
		QUOTING_MODE_NEVER    Never quote
2.4 Quoting char
	
	This is the character used for quoting..
	(Normally this should be set to " )

2.5 Sheet list
==============
	
	The sheet list contains all sheets to be exported.
	
	You can add sheets by calling :
		
		Sheet *sheet;

		stf_export_options_sheet_list_add (export_options, sheet);
	
	You can clear the list by calling :

		stf_export_options_sheet_list_clear (export_options);
	
3. Callback routine
===================

	The callback routine is called once data has to be written.
	You _must_ set this, if you do not the stf exporter will not
	know where to export the data too..

	You can set it by calling :
	
		FILE *file;
		
		stf_export_options_set_write_callback (export_options, my_write_func, file);

	The callback routine should look like this :

		my_write_func (char *string, gpointer data)
		{
			/* write string to file
			 * (in this case @data is a FILE* pointer
			 * so fputs (string, data) would be feasible
			 */
		}

4. Exporting
============

	After having set all the options, you can call :

		stf_export (export_options);

	This will call the callback routine (see 3) multiple times.