Skip Menu |

This queue is for tickets about the Spreadsheet-WriteExcel CPAN distribution.

Maintainer(s)' notes

If you are reporting a bug in Spreadsheet::WriteExcel here are some pointers

1) State the issues as clearly and as concisely as possible. A simple program or Excel test file (see below) will often explain the issue better than a lot of text.

2) Provide information on your system, version of perl and module versions. The following program will generate everything that is required. Put this information in your bug report.

    #!/usr/bin/perl -w

    print "\n    Perl version   : $]";
    print "\n    OS name        : $^O";
    print "\n    Module versions: (not all are required)\n";

    my @modules = qw(
                      Spreadsheet::WriteExcel
                      Parse::RecDescent
                      File::Temp
                      OLE::Storage_Lite
                      IO::Stringy
                      Spreadsheet::ParseExcel
                      Scalar::Util
                      Unicode::Map
                    );

    for my $module (@modules) {
        my $version;
        eval "require $module";

        if (not $@) {
            $version = $module->VERSION;
            $version = '(unknown)' if not defined $version;
        }
        else {
            $version = '(not installed)';
        }

        printf "%21s%-24s\t%s\n", "", $module, $version;
    }

    __END__

3) Upgrade to the latest version of Spreadsheet::WriteExcel (or at least test on a system with an upgraded version). The issue you are reporting may already have been fixed.

4) Create a small but complete example program that demonstrates your problem. The program should be as small as possible. At the same time it should be a complete program that generates an Excel file. If the Spreadsheet::WriteExcel section is part of a much larger program then simplify it down to the essentials. Simulate any DB reads with an array.

5) Say if you tested with Excel, OpenOffice, Gnumeric or something else. Say which version of that application you used.

6) If you are submitting a patch you should check with the author whether the issue has already been patched or if a fix is in the works. Patches should be accompanied by test cases.

Asking a question

If you would like to ask a more general question there is the Spreadsheet::WriteExcel Google Group.

Report information
The Basics
Id: 50361
Status: resolved
Priority: 0/
Queue: Spreadsheet-WriteExcel

People
Owner: Nobody in particular
Requestors: ftl [...] dnv.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 2.25
Fixed in: (no value)



Subject: Include images generated by Perl, (and not only from file)
Ref to 2.25. I have some images generated by GD I need to insert into a spreadsheet, and would love to include those without saving to file, and then import. I have included code to modify the interface of $ws->insert_image (...), to allow $file to be a ref to the actual content. In practice, this can be done by 1) modifying &insert_image() to accept a ref as filename, croak "Couldn't locate $image: $!" unless ref $image || -e $image; 2) modifying &_process_images() to accept a ref as filename if (ref $filename) { $data = $$filename; } else { # Open the image file and import the data. I have also added a fifth sheet "InlineImage" in the images.pl example, demonstrating inclusion of a GD image. The pod should be extended with The $filename may be an actual filename, or ref to the content itself, e.g. an image generated by GD, or Image::Magick. my $image = make_gd_image(): $worksheet3->insert_image('A1', \$image);
Subject: images.pl
#!/usr/bin/perl -w ####################################################################### # # Example of how to insert images into an Excel worksheet using the # Spreadsheet::WriteExcel insert_image() method. # # reverse('©'), October 2001, John McNamara, jmcnamara@cpan.org # use lib 'C:\Development\Erm3x\Develop\DNVModule'; use strict; use Spreadsheet::WriteExcel; # Create a new workbook called simple.xls and add a worksheet my $workbook = Spreadsheet::WriteExcel->new("images.xls"); my $worksheet1 = $workbook->add_worksheet('Image 1'); my $worksheet2 = $workbook->add_worksheet('Image 2'); my $worksheet3 = $workbook->add_worksheet('Image 3'); my $worksheet4 = $workbook->add_worksheet('Image 4'); # Insert a basic image $worksheet1->write('A10', "Image inserted into worksheet."); $worksheet1->insert_image('A1', 'republic.png'); # Insert an image with an offset $worksheet2->write('A10', "Image inserted with an offset."); $worksheet2->insert_image('A1', 'republic.png', 32, 10); # Insert a scaled image $worksheet3->write('A10', "Image scaled: width x 2, height x 0.8."); $worksheet3->insert_image('A1', 'republic.png', 0, 0, 2, 0.8); # Insert an image over varied column and row sizes # This does not require any additional work # Set the cols and row sizes # NOTE: you must do this before you call insert_image() $worksheet4->set_column('A:A', 5); $worksheet4->set_column('B:B', undef, undef, 1); # Hidden $worksheet4->set_column('C:D', 10); $worksheet4->set_row(0, 30); $worksheet4->set_row(3, 5); $worksheet4->write('A10', "Image inserted over scaled rows and columns."); $worksheet4->insert_image('A1', 'republic.png'); my $image = make_inline_image(); if ($image) { my $worksheet5 = $workbook->add_worksheet('InlineImage'); $worksheet5->insert_image('A1', \$image); } #from http://search.cpan.org/~lds/GD-2.44/GD.pm sub make_inline_image { eval "require GD;"; if ($@) { return 0; } else { # create a new image my $im = new GD::Image(100,100); # allocate some colors my $white = $im->colorAllocate(255,255,255); my $black = $im->colorAllocate(0,0,0); my $red = $im->colorAllocate(255,0,0); my $blue = $im->colorAllocate(0,0,255); # make the background transparent and interlaced $im->transparent($white); $im->interlaced('true'); # Put a black frame around the picture $im->rectangle(0,0,99,99,$black); # Draw a blue oval $im->arc(50,50,95,75,0,360,$blue); # And fill it with red $im->fill(50,50,$red); # return the png image return $im->png; } }
Subject: Worksheet.pm

Message body is not shown because it is too large.

Subject: Workbook.pm

Message body is not shown because it is too large.

On Fri Oct 09 08:58:37 2009, ftl wrote: Show quoted text
> Ref to 2.25. > > I have some images generated by GD I need to insert into a > spreadsheet, and would love to include those without saving to file, > and then import. > > I have included code to modify the interface of $ws->insert_image > (...), to allow $file to be a ref to the actual content. >
Hi, This feature was on the TODO list. I was waiting for someone to ask for it. I'll look into adding it in a later release. John. --
Closing this issue. Can't fix.