Hi, Perl monks

I got this code from below URL

https://metacpan.org/pod/release/JMCNAMARA/Excel-Writer-XLSX-0.94/lib/Excel/Writer/XLSX/Chart/Doughnut.pm

#!/usr/bin/perl use strict; use warnings; use Excel::Writer::XLSX; my $workbook = Excel::Writer::XLSX->new( 'chart_doughnut.xlsx' ); my $worksheet = $workbook->add_worksheet(); my $bold = $workbook->add_format( bold => 1 ); # Add the worksheet data that the charts will refer to. my $headings = [ 'Category', 'Values' ]; my $data = [ [ 'Glazed', 'Chocolate', 'Cream' ], [ 50, 35, 15 ], ]; $worksheet->write( 'A1', $headings, $bold ); $worksheet->write( 'A2', $data ); # Create a new chart object. In this case an embedded chart. my $chart = $workbook->add_chart( type => 'doughnut', embedded => 1 ); # Configure the series. Note the use of the array ref to define ranges +: # [ $sheetname, $row_start, $row_end, $col_start, $col_end ]. $chart->add_series( name => 'Doughnut sales data', categories => [ 'Sheet1', 1, 3, 0, 0 ], values => [ 'Sheet1', 1, 3, 1, 1 ], ); # Add a title. $chart->set_title( name => 'Popular Doughnut Types' ); # Set an Excel chart style. Colors with white outline and shadow. $chart->set_style( 10 ); # Insert the chart into the worksheet (with an offset). $worksheet->insert_chart( 'C2', $chart, 25, 10 );

When I run perl filename.cgi, it creates the chart_doughnut.xlsx file. I copied it to web root /var/ww/html/chart_doughnut.xlsx. while accessing http://ipaddress/chart_doughnut.xlsx, Excel file will be downloaded to my Pc. Then, I can view it.

What I need is TO display it's image doughnut chart via my web browser.. I think I expalined correctly..

How can I achive it? Pls help me.. It may be a MINOR task for perl monks..

I found below Urls. I tried them. But, I am stil going without Succuess.

https://www.perlmonks.org/?node_id=1025384

https://fastapi.metacpan.org/source/JMCNAMARA/Excel-Writer-XLSX-0.98/examples/cgi.pl

below code from this URl

https://metacpan.org/pod/Excel::Writer::XLSX#EXAMPLES

binmode( STDOUT ); my $workbook = Excel::Writer::XLSX->new( \*STDOUT );

expect your INPUTS


In reply to How to display the Excel::Writer::XLSX chart image to the web browser with CGI? by theravadamonk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.