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

Cells format features #115

Closed
sirhvd opened this issue May 2, 2019 · 7 comments
Closed

Cells format features #115

sirhvd opened this issue May 2, 2019 · 7 comments

Comments

@sirhvd
Copy link

sirhvd commented May 2, 2019

How can I format a specific cell?

Ex: Number format, percent format, color, font style only for a specific cell, ...

Thank you for the great excel lib.

@viest
Copy link
Owner

viest commented May 2, 2019

examples:

use Vtiful\Kernel\Excel;
use Vtiful\Kernel\Format;

$excel = new \Vtiful\Kernel\Excel([
    'path' => './'
]);

$excelObject = $excel->fileName('tutorial.xlsx');
$excelHandle = $excelObject->getHandle();

// new format object
$format = new Format($excelHandle);

// set format
$formatResource = $format->bold()
    ->italic()
    ->color(Format::COLOR_ORANGE)
    ->number('#,##0')
    ->toResource();

// insert data
$filePath = $excelObject->header(['name', 'balance'])
    ->data([
        ['viest', 1000],
        ['wjx',   100000]
    ])
    ->setColumn('B:B', 50, $formatResource)  // set format
    ->output();

image

I hope this example will help you.

@sirhvd
Copy link
Author

sirhvd commented May 3, 2019

Thank you. This will help me a lot.
But can I ask you for the newest php_xlswriter.dll file?
I'm tried to follow your compile instruction from https://github.com/viest/php-ext-excel-export/blob/master/README_zh.md but it's can't compile. It's told me
"xlswriter not enabled, xlsxwriter.lib or headers not found"
Thank you.

@viest
Copy link
Owner

viest commented May 3, 2019

Your platform is Windows or Linux?

@sirhvd
Copy link
Author

sirhvd commented May 3, 2019

I'm using Windows PHP 7.1.

@viest
Copy link
Owner

viest commented May 3, 2019

Please download 1.2.4 at PECL.

PECL is building, just a moment, please.

https://pecl.php.net/package/xlswriter

@sirhvd
Copy link
Author

sirhvd commented May 3, 2019

Really thank for your time.
Can I ask you how to compile this on windows? So I can build myself, I don't want to waste your time for this.
Thank you.

@viest
Copy link
Owner

viest commented May 3, 2019

@viest viest closed this as completed May 3, 2019
@viest viest pinned this issue May 14, 2019
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

2 participants