1
package Spreadsheet::WriteExcel::Chart;
3
###############################################################################
5
# Chart - A writer class for Excel Charts.
8
# Used in conjunction with Spreadsheet::WriteExcel
10
# Copyright 2000-2005, John McNamara, jmcnamara@cpan.org
12
# Documentation after __END__
19
use Spreadsheet::WriteExcel::BIFFwriter;
24
use vars qw($VERSION @ISA);
25
@ISA = qw(Spreadsheet::WriteExcel::BIFFwriter);
29
###############################################################################
33
# Constructor. Creates a new Chart object from a BIFFwriter object
38
my $self = Spreadsheet::WriteExcel::BIFFwriter->new();
40
$self->{_filename} = $_[0];
41
$self->{_name} = $_[1];
42
$self->{_index} = $_[2];
43
$self->{_encoding} = $_[3];
44
$self->{_activesheet} = $_[4];
45
$self->{_firstsheet} = $_[5];
47
$self->{_type} = 0x0200;
48
$self->{_ext_sheets} = [];
49
$self->{_using_tmpfile} = 1;
50
$self->{_filehandle} = "";
51
$self->{_fileclosed} = 0;
53
$self->{_xls_rowmax} = 0;
54
$self->{_xls_colmax} = 0;
55
$self->{_xls_strmax} = 0;
56
$self->{_dim_rowmin} = 0;
57
$self->{_dim_rowmax} = 0;
58
$self->{_dim_colmin} = 0;
59
$self->{_dim_colmax} = 0;
60
$self->{_dim_changed} = 0;
61
$self->{_colinfo} = [];
62
$self->{_selection} = [0, 0];
64
$self->{_active_pane} = 3;
66
$self->{_selected} = 0;
69
$self->{_paper_size} = 0x0;
70
$self->{_orientation} = 0x1;
71
$self->{_header} = '';
72
$self->{_footer} = '';
73
$self->{_hcenter} = 0;
74
$self->{_vcenter} = 0;
75
$self->{_margin_head} = 0.50;
76
$self->{_margin_foot} = 0.50;
77
$self->{_margin_left} = 0.75;
78
$self->{_margin_right} = 0.75;
79
$self->{_margin_top} = 1.00;
80
$self->{_margin_bottom} = 1.00;
82
$self->{_title_rowmin} = undef;
83
$self->{_title_rowmax} = undef;
84
$self->{_title_colmin} = undef;
85
$self->{_title_colmax} = undef;
86
$self->{_print_rowmin} = undef;
87
$self->{_print_rowmax} = undef;
88
$self->{_print_colmin} = undef;
89
$self->{_print_colmax} = undef;
91
$self->{_print_gridlines} = 1;
92
$self->{_screen_gridlines} = 1;
93
$self->{_print_headers} = 0;
95
$self->{_fit_page} = 0;
96
$self->{_fit_width} = 0;
97
$self->{_fit_height} = 0;
99
$self->{_hbreaks} = [];
100
$self->{_vbreaks} = [];
102
$self->{_protect} = 0;
103
$self->{_password} = undef;
105
$self->{_col_sizes} = {};
106
$self->{_row_sizes} = {};
108
$self->{_col_formats} = {};
109
$self->{_row_formats} = {};
111
$self->{_zoom} = 100;
112
$self->{_print_scale} = 100;
114
$self->{_leading_zeros} = 0;
116
$self->{_outline_row_level} = 0;
117
$self->{_outline_style} = 0;
118
$self->{_outline_below} = 1;
119
$self->{_outline_right} = 1;
120
$self->{_outline_on} = 1;
123
$self->_initialize();
128
###############################################################################
135
my $filename = $self->{_filename};
136
my $filehandle = FileHandle->new($filename) or
137
die "Couldn't open $filename in add_chart_ext(): $!.\n";
139
binmode($filehandle);
141
$self->{_filehandle} = $filehandle;
142
$self->{_datasize} = -s $filehandle;
147
###############################################################################
151
# Add data to the beginning of the workbook (note the reverse order)
152
# and to the end of the workbook.
160
###############################################################################
164
# Retrieve the worksheet name.
170
return $self->{_name};
174
###############################################################################
178
# Retrieves data from memory in one chunk, or from disk in $buffer
187
return $tmp if read($self->{_filehandle}, $tmp, $buffer);
194
###############################################################################
198
# Set this worksheet as a selected worksheet, i.e. the worksheet has its tab
205
$self->{_hidden} = 0; # Selected worksheet can't be hidden.
206
$self->{_selected} = 1;
210
###############################################################################
214
# Set this worksheet as the active worksheet, i.e. the worksheet that is
215
# displayed when the workbook is opened. Also set it as selected.
221
$self->{_hidden} = 0; # Active worksheet can't be hidden.
222
$self->{_selected} = 1;
223
${$self->{_activesheet}} = $self->{_index};
227
###############################################################################
231
# Hide this worksheet.
237
$self->{_hidden} = 1;
239
# A hidden worksheet shouldn't be active or selected.
240
$self->{_selected} = 0;
241
${$self->{_activesheet}} = 0;
242
${$self->{_firstsheet}} = 0;
246
###############################################################################
250
# Set this worksheet as the first visible sheet. This is necessary
251
# when there are a large number of worksheets and the activated
252
# worksheet is not visible on the screen.
254
sub set_first_sheet {
258
$self->{_hidden} = 0; # Active worksheet can't be hidden.
259
${$self->{_firstsheet}} = $self->{_index};
273
Chart - A writer class for Excel Charts.
277
See the documentation for Spreadsheet::WriteExcel
281
This module is used in conjunction with Spreadsheet::WriteExcel.
285
John McNamara jmcnamara@cpan.org
289
� MM-MMV, John McNamara.
291
All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the same terms as Perl itself.