miranj/craft-sheets-to-tables

添加一个 Twig 函数以将电子表格转换为 HTML 表格。

1.2.0 2024-04-14 13:39 UTC

This package is auto-updated.

Last update: 2024-09-14 14:41:36 UTC


README

Sheets to Tables icon

表格到表格

Craft CMS 插件添加了一个 Twig 函数,用于将电子表格转换为 HTML 表格。

内容

用法

要将电子表格文件转换为 HTML `

`,请将 craft\elements\Asset 对象作为参数传递给 `sheetstotables( asset )` Twig 函数。

{% set spreadsheet = craft.assets.kind('excel').one() %}

{{ sheetstotables(spreadsheet) }}

如果电子表格文件包含多个工作表,则仅将第一个工作表的内容渲染为表格。

支持的文件格式

安装

您可以从 插件商店 或使用 Composer 安装此插件。

从插件商店

转到项目控制面板中的插件商店,搜索“表格到表格”。然后在模态窗口中单击“安装”按钮。

使用 Composer

打开终端并运行以下命令

# go to the project directory
cd /path/to/project

# tell composer to use the plugin
composer require miranj/craft-sheets-to-tables

# tell Craft to install the plugin
./craft plugin/install sheets-to-tables

需求

此插件需要 Craft CMS 3、4 或 5。

Miranj 提供