Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to hide specific columns? #313

Open
prabakaran-p opened this issue Sep 13, 2021 · 0 comments
Open

How to hide specific columns? #313

prabakaran-p opened this issue Sep 13, 2021 · 0 comments

Comments

@prabakaran-p
Copy link

Hi There,

I want to hide specific column in xlsx.
I tried this way 'hidden'=>[1,1,1,1,0,0,0,0] in the writeSheetHeader and writeSheetRow.
But it is hiding the entire row in the xlsx.
`<?php
set_include_path( get_include_path().PATH_SEPARATOR."..");
include_once("xlsxwriter.class.php");

$header = array(
'c1-text'=>'string',//text
'c2-text'=>'@',//text
'c3-integer'=>'integer',
'c4-integer'=>'0',
'c5-price'=>'price',
'c6-price'=>'#,##0.00',//custom
'c7-date'=>'date',
'c8-date'=>'YYYY-MM-DD',
);
$rows = array(
array('x101',102,103,104,105,106,'2018-01-07','2018-01-08'),
array('x201',202,203,204,205,206,'2018-02-07','2018-02-08'),
array('Total',302,303,304,305,306,'2018-03-07','2018-03-08')
);
$writer = new XLSXWriter();

$writer->writeSheetHeader('Sheet1', $header, $style = array('widths'=>[40,50,20,10,40,50,20,10],'hidden'=>[1,1,1,1,0,0,0,0]));
$style = array('widths'=>40, 'hidden'=>[1,1,1,1,0,0,0,0]);
foreach($rows as $row){
$writer->writeSheetRow('Sheet1', $row, $style);
}
$writer->writeToFile(rand(1000,9999).'xlsx-simples.xlsx');

`
Can anyone help me to find a solution?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant