Skip to content

Commit

Permalink
2.20 October 6 2007 - Major
Browse files Browse the repository at this point in the history
    + Added autofilter() and filter_column() method and
      autofilter.pl example.

    + Added embed_chart() method to allow extracted chart
      templates to be embedded in a worksheet.
      Added demo4.pl and demo5.pl examples.

    + Added the insert_image() method and proper Excel 97
      style image handling for PNG and BMP.
      Images now work with Gnumeric and OpenOffice.
      insert_bitmap() is now deprecated.

    ! Made pane split optional when calling freeze_panes().
      Also renamed thaw_panes() as split_panes(). The old
      method name is still available, but deprecated.

    ! Renamed write_unicode() and write_unicode_le() methods
      to the more explicit write_utf16be_string() and
      write_utf16le_string(). The old method names are
      still available, but deprecated.
  • Loading branch information
jmcnamara committed Oct 6, 2007
1 parent fed4a32 commit a3f19a4
Show file tree
Hide file tree
Showing 57 changed files with 4,503 additions and 1,034 deletions.
31 changes: 31 additions & 0 deletions Changes
@@ -1,5 +1,36 @@
Revision history for Perl module Spreadsheet::WriteExcel.


2.20 October 6 2007 - Major


+ Added autofilter() and filter_column() method and
autofilter.pl example.

+ Added embed_chart() method to allow extracted chart
templates to be embedded in a worksheet.
Added demo4.pl and demo5.pl examples.

+ Added the insert_image() method and proper Excel 97
style image handling for PNG and BMP.
Images now work with Gnumeric and OpenOffice.
insert_bitmap() is now deprecated.

! Made pane split optional when calling freeze_panes().
Also renamed thaw_panes() as split_panes(). The old
method name is still available, but deprected..

! Renamed write_unicode() and write_unicode_le() methods
to the more explicit write_utf16be_string() and
write_utf16le_string(). The old method names are
still available, but deprected.


2.19 June 14 2007 - Major

+ Beta testing only. Not release to CPAN.


2.18 January 18 2007 - Minor

! Correct invalid user set_column() calls to prevent
Expand Down
14 changes: 11 additions & 3 deletions MANIFEST
Expand Up @@ -29,6 +29,9 @@ t/21_escher.t
t/22_mso_drawing_group.t
t/23_note.t
t/24_txo.t
t/26_autofilter.t
t/27_autofilter.t
t/28_autofilter.t

doc/index.html
doc/WriteExcel.html
Expand All @@ -54,6 +57,7 @@ doc/tpj0503-0004-05.gif
doc/win32ole.gif

examples/README
examples/autofilter.pl
examples/autofit.pl
examples/bigfile.pl
examples/bug_report.pl
Expand Down Expand Up @@ -95,7 +99,7 @@ examples/panes.pl
examples/protection.pl
examples/regions.pl
examples/repeat.pl
examples/republic.bmp
examples/republic.png
examples/right_to_left.pl
examples/row_wrap.pl
examples/sales.pl
Expand All @@ -107,7 +111,6 @@ examples/stocks.pl
examples/tab2xls.pl
examples/tab_colors.pl
examples/textwrap.pl
examples/unicode.pl
examples/unicode_2022_jp.pl
examples/unicode_2022_jp.txt
examples/unicode_8859_11.pl
Expand All @@ -121,14 +124,15 @@ examples/unicode_cp1251.txt
examples/unicode_cp1256.pl
examples/unicode_cp1256.txt
examples/unicode_cyrillic.pl
examples/unicode_japan.pl
examples/unicode_koi8r.pl
examples/unicode_koi8r.txt
examples/unicode_list.pl
examples/unicode_polish_utf8.pl
examples/unicode_polish_utf8.txt
examples/unicode_shift_jis.pl
examples/unicode_shift_jis.txt
examples/unicode_utf16.pl
examples/unicode_utf16_japan.pl
examples/win32ole.pl
examples/writeA1.pl
examples/write_arrays.pl
Expand All @@ -145,8 +149,12 @@ charts/charts.txt
charts/demo1.pl
charts/demo2.pl
charts/demo3.pl
charts/demo4.pl
charts/demo5.pl
charts/Chart1.xls
charts/Chart2.xls
charts/Chart3.xls
charts/Chart4.xls
charts/Chart5.xls

bin/chartex
2 changes: 1 addition & 1 deletion META.yml
@@ -1,6 +1,6 @@
name: Spreadsheet-WriteExcel
abstract: Write to a cross platform Excel binary file
version: 2.18
version: 2.20
version_from: lib/Spreadsheet/WriteExcel.pm
installdirs: site
requires:
Expand Down
2 changes: 1 addition & 1 deletion Makefile.PL
Expand Up @@ -13,7 +13,7 @@ WriteMakefile(
'NEEDS_LINKING' => 0,
'PREREQ_PM' => { Parse::RecDescent => 0,
File::Temp => 0,
OLE::Storage_Lite => 0.14
OLE::Storage_Lite => 0.14,
},
'dist' => { COMPRESS => 'gzip --best', SUFFIX => 'gz' },
'EXE_FILES' => ['bin/chartex'],
Expand Down
80 changes: 69 additions & 11 deletions bin/chartex
Expand Up @@ -5,7 +5,7 @@
# chartex - A utility to extract charts from an Excel file for
# insertion into a Spreadsheet::WriteExcel file.
#
# reverse('©'), September 2004, John McNamara, jmcnamara@cpan.org
# reverse('©'), September 2007, John McNamara, jmcnamara@cpan.org
#
# Documentation after __END__
#
Expand All @@ -25,7 +25,8 @@ my $chart_index = 1;
my $sheet_index = -1;
my @sheetnames;
my @exrefs;

my $depth_count = 0;
my $max_font = 0;

#
# Do the Getopt and Pod::Usage routines.
Expand Down Expand Up @@ -109,29 +110,76 @@ while (read $tmpfile, $header, 4) {
my $filename = sprintf "%s%02d.bin", $chart_name, $chart_index;
open CHART, ">$filename" or die "Couldn't open $filename: $!";
binmode CHART;
printf "\nExtracting \"%s\" to %s", $sheetnames[$sheet_index],
$filename;

my $sheet_name = $sheetnames[$sheet_index];
$sheet_name .= ' embedded' if $depth_count;

printf "\nExtracting \%s\ to %s", $sheet_name, $filename;
$in_chart = 1;
$chart_index++;
}
$sheet_index++;
$depth_count++;
}


# FBI, Chart fonts
if ($record == 0x1060) {

my $index = substr $data, 8, 2, '';
$index = unpack 'v', $index;

# Ignore the inbuilt fonts.
if ($index >= 5) {
$max_font = $index if $index > $max_font;

# Shift index past S::WE fonts
$index += 2;
}

$data .= pack 'v', $index;
}

# FONTX, Chart fonts
if ($record == 0x1026) {

my $index = unpack 'v', $data;

# Ignore the inbuilt fonts.
if ($index >= 5) {
$max_font = $index if $index > $max_font;

# Shift index past S::WE fonts
$index += 2;
}

$data = pack 'v', $index;
}



if ($in_chart) {
print CHART $header, $data;
}


# EOF
if ($record == 0x000A) {
$in_chart = 0;
$depth_count--;
$sheet_index++ if $depth_count == 0;
;
}
}



print "\n\n", ('=' x 60), "\n";
print "Add the following near the start of your program.\n";
print "Change variable name \$worksheet if required.\n\n";
if ($chart_index > 1) {
print "\n\n";
print "Add the following near the start of your program\n";
print "and change the variable names if required.\n\n";
}
else {
print "\nNo charts found in workbook\n";
}

for my $aref (@exrefs) {
my $sheet1 = $sheetnames[$aref->[1]];
Expand All @@ -148,9 +196,19 @@ for my $aref (@exrefs) {

$range = "'$range'" if $range =~ /[^\w:]/;

print " \$worksheet->store_formula(\"=$range!A1\");\n";
print " \$worksheet->store_formula('=$range!A1');\n";
}

print "\n";

for my $i (5 .. $max_font) {

printf " my \$chart_font_%d = \$workbook->add_format(font_only => 1);\n",
$i -4;

}





Expand Down Expand Up @@ -213,7 +271,7 @@ John McNamara jmcnamara@cpan.org
=head1 VERSION
Version 0.01.
Version 0.02.
=head1 COPYRIGHT
Expand Down
Binary file modified charts/Chart1.xls
Binary file not shown.
Binary file modified charts/Chart2.xls
Binary file not shown.
Binary file modified charts/Chart3.xls
Binary file not shown.
Binary file added charts/Chart4.xls
Binary file not shown.
Binary file added charts/Chart5.xls
Binary file not shown.
10 changes: 10 additions & 0 deletions charts/README
Expand Up @@ -12,10 +12,14 @@ The files are as follows:
demo1.pl A demo of a line chart.
demo2.pl A demo of a pie chart.
demo3.pl A demo of a Open-High-Low-Close stock chart.
demo4.pl A demo of a Open-High-Low-Close stock chart (embedded).
demo5.pl A demo of a line chart (embedded).

Chart1.xls A template for use with demo1.pl.
Chart2.xls A template for use with demo2.pl.
Chart3.xls A template for use with demo3.pl.
Chart4.xls A template for use with demo4.pl.
Chart5.xls A template for use with demo5.pl.

* If you performed a normal installation then the chartex utility
should be installed to your 'somepath/perl/bin' directory and
Expand All @@ -33,6 +37,12 @@ You can run the examples as follows:
perl chartex.pl -c=demo3 Chart3.xls
perl demo3.pl

perl chartex.pl -c=demo4 Chart4.xls
perl demo4.pl

perl chartex.pl -c=demo5 Chart5.xls
perl demo5.pl


See charts.txt for further details of how to include externally generated charts in a Spreadsheet::WriteExcel file.

0 comments on commit a3f19a4

Please sign in to comment.