# 读取富文本

* 扩展版本大于等于 `1.6.0`；
* 编译时需添加 `--enable-reader`；

`nextRowRich()` 与 `nextRow()` 类似，但字符串单元格会展开为富文本片段数组，保留每段文字的字体属性。

## 函数原型

```php
nextRowRich(): ?array
```

## 返回值

返回当前行的单元格数组：迭代到末尾时返回 `null`。

* 字符串 / 共享字符串单元格 → 数组，每个元素为一个文本片段：
  * `text` *(string)* — 片段文本；
  * `font` *(array)* — `{name, size, bold, italic, strike, underline, color}`，未声明字段为 `null`。
* 其他类型（数字、日期、布尔、错误、空）→ 与 `nextRow()` 相同的原始值。

## 示例

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

$excel->openFile('source.xlsx')->openSheet();

while (($row = $excel->nextRowRich()) !== null) {
    print_r($row);
}
// 一行示例：
// Array
// (
//     [0] => Array
//         (
//             [0] => Array
//                 (
//                     [text] => Hello
//                     [font] => Array ( [name] => Calibri [size] => 11 [bold] => 1 [italic] => 0 ... )
//                 )
//             [1] => Array ( [text] =>  world, [font] => Array (...) )
//         )
//     [1] => 42        // 数字单元格保持原值
// )
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://xlswriter-docs.viest.me/zhong-wen-jian-ti/reader/next-row-rich.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
