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

没有找到单元格设置内容颜色功能? #488

Closed
majingsign opened this issue Jul 16, 2023 · 1 comment
Closed

没有找到单元格设置内容颜色功能? #488

majingsign opened this issue Jul 16, 2023 · 1 comment

Comments

@majingsign
Copy link

图1
(图1)
图2
(图2)

详细说明:

  • 图1是要的效果,我想修改一个单元格里面的颜色,实际却设置成了一行的颜色。
  • 图2是代码,在代码中设置C12,按理说是只有C12单元格才会变红,但这样影响了一整行。

我的理解是:C12只设置一个单元格,C1:C12设置区间的颜色。

辛苦作者再研究一下,修复下这个问题。

@lait233
Copy link

lait233 commented Jul 28, 2023

这个setRow是针对整行设置样式的,如果你需要单个单元格设置样式,请使用 insertText

$titleStyle = ( new Format( $resource ) )->align( Format::FORMAT_ALIGN_LEFT )->background( Format::COLOR_RED )->toResource();  // 左对齐+红色字体样式资源
$fileObject = $fileObject->insertText( 2, 1042, '我的字体颜色是红色', null, $titleStyle ); 
```php

@viest viest closed this as completed Nov 21, 2023
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

3 participants