Excel-Writer-XLSX

 view release on metacpan or  search on metacpan

lib/Excel/Writer/XLSX/Chartsheet.pm  view on Meta::CPAN

    $self->_write_sheet_views();

    # Write the sheetProtection element.
    $self->_write_sheet_protection();

    # Write the printOptions element.
    $self->_write_print_options();

    # Write the worksheet page_margins.
    $self->_write_page_margins();

    # Write the worksheet page setup.
    $self->_write_page_setup();

    # Write the headerFooter element.
    $self->_write_header_footer();

    # Write the drawing element.
    $self->_write_drawings();

    # Write the legacyDrawingHF element.
    $self->_write_legacy_drawing_hf();

    # Close the worksheet tag.
    $self->xml_end_tag( 'chartsheet' );

    # Close the XML writer filehandle.
    $self->xml_get_fh()->close();
}


###############################################################################
#
# Public methods.
#
###############################################################################

# Over-ride parent protect() method to protect both worksheet and chart.
sub protect {

    my $self         = shift;
    my $password     = shift || '';
    my $user_options = shift;
    my $options      = {};

    # Objects are default on for chartsheets.
    if ( defined $user_options->{objects} ) {
        $options->{objects} = not $user_options->{objects};
    }
    else {
        $options->{objects} = 0;
    }

    if ( defined $user_options->{content} ) {
        $options->{content} = $user_options->{content};
    }
    else {
        $options->{content} = 1;
    }

    # If objects and content are off then the chartsheet isn't locked, except
    # if it has a password.
    if ( $password eq '' && $options->{objects} && !$options->{content} ) {
        return;
    }

    $self->{_chart}->{_protection} = 1;

    # Turn off worksheet defaults.
    $options->{sheet}     = 0;
    $options->{scenarios} = 1;

    $self->SUPER::protect( $password, $options );
}


###############################################################################
#
# Encapsulated Chart methods.
#
###############################################################################

sub add_series            { return shift->{_chart}->add_series( @_ ) }
sub combine               { return shift->{_chart}->combine( @_ ) }
sub set_x_axis            { return shift->{_chart}->set_x_axis( @_ ) }
sub set_y_axis            { return shift->{_chart}->set_y_axis( @_ ) }
sub set_x2_axis           { return shift->{_chart}->set_x2_axis( @_ ) }
sub set_y2_axis           { return shift->{_chart}->set_y2_axis( @_ ) }
sub set_title             { return shift->{_chart}->set_title( @_ ) }
sub set_legend            { return shift->{_chart}->set_legend( @_ ) }
sub set_plotarea          { return shift->{_chart}->set_plotarea( @_ ) }
sub set_chartarea         { return shift->{_chart}->set_chartarea( @_ ) }
sub set_style             { return shift->{_chart}->set_style( @_ ) }
sub show_blanks_as        { return shift->{_chart}->show_blanks_as( @_ ) }
sub show_na_as_empty_cell { return shift->{_chart}->show_na_as_empty_cell( @_ ) }
sub show_hidden_data      { return shift->{_chart}->show_hidden_data( @_ ) }
sub set_size              { return shift->{_chart}->set_size( @_ ) }
sub set_table             { return shift->{_chart}->set_table( @_ ) }
sub set_up_down_bars      { return shift->{_chart}->set_up_down_bars( @_ ) }
sub set_drop_lines        { return shift->{_chart}->set_drop_lines( @_ ) }
sub set_high_low_lines    { return shift->{_chart}->high_low_lines( @_ ) }



###############################################################################
#
# Internal methods.
#
###############################################################################


###############################################################################
#
# _prepare_chart()
#
# Set up chart/drawings.
#
sub _prepare_chart {

    my $self       = shift;
    my $index      = shift;



( run in 0.714 second using v1.01-cache-2.11-cpan-39bf76dae61 )