[{"id":"b66f8b1e-cc14-4e89-9679-abd5687d283d","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"569bb90a-ea68-46c6-96f1-ab151c120714","tags":[{"product":null,"links":null,"id":"a2f84374-4a3f-4d22-96fd-765e9de495bf","name":"\u66F4\u65B0","color":"Coral","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"5eb52f08-2d1a-4362-9ffc-4871bdc10f3f","tags":[{"product":null,"links":null,"id":"a2f84374-4a3f-4d22-96fd-765e9de495bf","name":"\u66F4\u65B0","color":"Coral","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"341dd607-b97d-4d70-bde2-53acda6b6c95","tags":[{"product":null,"links":null,"id":"a2f84374-4a3f-4d22-96fd-765e9de495bf","name":"\u66F4\u65B0","color":"Coral","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"05349273-414f-4208-9ea2-c4fc8f4ea2cb","tags":[{"product":null,"links":null,"id":"a2f84374-4a3f-4d22-96fd-765e9de495bf","name":"\u66F4\u65B0","color":"Coral","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"86089f76-b778-4d52-821e-6f27de3df613","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"b81e4fd6-1fc5-43a0-a258-b6e16a5cbec6","tags":[{"product":null,"links":null,"id":"a2f84374-4a3f-4d22-96fd-765e9de495bf","name":"\u66F4\u65B0","color":"Coral","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"8aa8ce31-43e4-438e-951f-241608435260","tags":[{"product":null,"links":null,"id":"a2f84374-4a3f-4d22-96fd-765e9de495bf","name":"\u66F4\u65B0","color":"Coral","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"37343f41-6ec2-4c7e-b21d-2cc18d5ce1e0","tags":[{"product":null,"links":null,"id":"a2f84374-4a3f-4d22-96fd-765e9de495bf","name":"\u66F4\u65B0","color":"Coral","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"5915e52f-64f8-4146-b8bd-81bead6324a3","tags":[{"product":null,"links":null,"id":"a2f84374-4a3f-4d22-96fd-765e9de495bf","name":"\u66F4\u65B0","color":"Coral","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"836ba889-af9e-460d-a4cc-c24d922795f2","tags":[{"product":null,"links":null,"id":"a2f84374-4a3f-4d22-96fd-765e9de495bf","name":"\u66F4\u65B0","color":"Coral","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"4ae14b06-bb68-4394-a210-a46b8f028346","tags":[{"product":null,"links":null,"id":"a2f84374-4a3f-4d22-96fd-765e9de495bf","name":"\u66F4\u65B0","color":"Coral","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"d8f42066-e9dc-4411-bdcf-43b1a203370c","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"7ef86f16-b1a0-49f7-9592-612b9be02b25","tags":[{"product":null,"links":null,"id":"a2f84374-4a3f-4d22-96fd-765e9de495bf","name":"\u66F4\u65B0","color":"Coral","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"b29c7775-a9a4-451e-a1b5-01d19ed5ca5e","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"e56f3989-8f81-46af-90fa-a4813eeb976f","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"2526c963-f170-45a8-923e-91b0712a9810","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"24575cf0-501a-44f9-8426-c40f8f4b5552","tags":[{"product":null,"links":null,"id":"a2f84374-4a3f-4d22-96fd-765e9de495bf","name":"\u66F4\u65B0","color":"Coral","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"1a6f8d7f-acd6-42be-8c4f-f464c6218381","tags":[{"product":null,"links":null,"id":"a2f84374-4a3f-4d22-96fd-765e9de495bf","name":"\u66F4\u65B0","color":"Coral","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"82b176fd-5cab-498c-909e-8fa7d29c38d8","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"1708b3a9-4f37-44a8-8f0e-f9a2d2e5d940","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"c9ac246e-29fb-4bc4-8231-8439795bb590","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"94f2a5c3-2539-436a-af75-23fbbd1a3957","tags":[{"product":null,"links":null,"id":"a2f84374-4a3f-4d22-96fd-765e9de495bf","name":"\u66F4\u65B0","color":"Coral","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"d99594f4-2d40-4df4-9419-ba2ca6aa3f7f","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"fd66e72d-0f10-4f57-9807-6db26290ab2e","tags":[{"product":null,"links":null,"id":"a2f84374-4a3f-4d22-96fd-765e9de495bf","name":"\u66F4\u65B0","color":"Coral","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"8f344863-503d-4bc3-a594-3815e7d55f5c","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"9be82601-de9d-4c18-948a-23ab6f4dd431","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"6495f3c0-b463-47e0-b08a-ca949672211e","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"b4bede08-3f08-4839-ba4a-abc7ac195bde","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"4afcdfc0-3ff5-4f2b-a223-f8fc042a5bbe","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"422062c4-fa40-4771-a86f-008efe6d86e5","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"d87e8013-86a7-4840-8d25-6f62e14eb4ac","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"a6acedfd-4043-4c64-a5d1-aec3326df9e7","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"dbdc0b24-06c4-48b9-8d6c-7455119dc773","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"a3856849-954a-4cfc-96a6-382e530d3638","tags":[{"product":null,"links":null,"id":"a2f84374-4a3f-4d22-96fd-765e9de495bf","name":"\u66F4\u65B0","color":"Coral","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"4a39306b-ffa5-433d-80a3-28e41f929b72","tags":[{"product":null,"links":null,"id":"a2f84374-4a3f-4d22-96fd-765e9de495bf","name":"\u66F4\u65B0","color":"Coral","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]}]
文档属性包含有关工作簿的信息,如标题、作者、主题等。SpreadJS 允许您在工作簿中管理这些属性。
要管理文档属性,SpreadJS 提供了类型为 IDocProps
接口的 docProps
属性。它允许自定义文档属性,例如 coreDocProps
、appDocProps
和 customDocProps
。
核心文档属性 - 这些是基本属性,如标题、创建者和关键字,提供关于文档的重要信息
应用文档属性 - 这些属性专用于管理文档,如经理、公司详情等
自定义文档属性 - 这些是用户定义的属性,可以以各种数据类型保存
以下代码示例描述了如何设置文档属性。
// Set core document properties.
spread.docProps.coreDocProps = {
title: 'Sample Document',
creator: 'Admin',
keywords: 'sample, document',
subject: 'Sample Subject',
description: 'This is a sample document',
category: 'Sample Category',
contentStatus: 'Draft',
created: '11/01/24',
lastPrinted: '20/01/24',
modified: '21/01/24',
lastModifiedBy: 'John'
};
// Set app document properties.
spread.docProps.appDocProps = {
manager: 'John',
company: 'XYZCompany',
hyperlinkBase: 'https://example.com/documents/'
};
// Set custom document properties.
spread.docProps.customDocPropsManager.all([
{ name: 'Kim', value: '1' },
{ name: 'Smith', value: '2' }
]);
// Get document properties.
console.log(spread.docProps.coreDocProps);
console.log(spread.docProps.appDocProps);
console.log(spread.docProps.customDocPropsManager.all());
您还可以使用 IDocProps
接口的 customDocPropsManager
属性更改文档的自定义属性。以下代码示例演示如何使用自定义属性管理器添加、删除、获取、列出所有以及清除与文档关联的自定义属性。
const customPropsManager = spread.docProps.customDocPropsManager;
customPropsManager.all([
{ name: 'name1', value: 'value1' },
{ name: 'name2', value: 'value2' },
]);
// Set new custom document properties.
customPropsManager.add('name3', 'value3');
customPropsManager.add('name1', 'value1_modified');
// Remove the custom document property 'name2'.
customPropsManager.remove('name2');
// Get the value of the custom document property 'name3'.
customPropsManager.get('name3'); // Output: 'value3'
// Get all remaining custom document properties.
customPropsManager.all(); // Output: [ { name: 'name1', value: 'value1_modified' }, { name: 'name3', value: 'value3' } ]
// Clear all custom document properties.
customPropsManager.clear();
要管理工作簿中的文档属性,请按照以下步骤操作。
查看或修改标准属性 点击文件选项卡并选择信息。
信息选项卡的右侧显示工作簿的属性。
添加或修改必要的信息。
点击文本字段外部以保存更改。
编辑高级属性
点击文件选项卡并选择信息
点击属性下拉菜单并选择高级属性
在“属性”对话框中,有不同的选项卡,例如“摘要”、“统计信息”、“内容”和“自定义”
每个选项卡有助于配置与文档相关的不同类型的信息。
默认情况下,选择摘要选项卡。您可以根据需要添加/更改文档摘要信息。您还可以在统计和内容选项卡中查看有关文档的一般信息。
点击自定义选项卡以定义额外的自定义属性。
在名称字段中,为自定义属性输入名称或从列表中选择。
在类型下拉列表中,选择数据类型。
可用的数据类型如下:
文本
日期
数字
是或否
在值字段中,输入与所选数据类型匹配的值。
您提供的值必须与类型列表中的选择匹配。例如,如果您在类型列表中选择“数字”,则必须在值框中输入一个数字。请注意,与属性类型不匹配的值将保存为文本。
点击添加
添加自定义属性后,它会显示在属性列表中。
此外,SpreadJS 提供了“链接到内容”设置,将文档内容链接到属性值,以便每当内容值更改时,文档属性会自动更新以反映新值。以下是一个说明该设置如何工作的示例。
示例:假设您有一个包含多个表格和图表的销售数据工作簿。
创建一个名为“Total Sales”的文档属性,该属性会在 Sheet1 中的单元格 B10 的总销售值发生变化时自动更新
在此示例中,首先为单元格创建一个自定义名称,如 Sheet1!$B$10
自定义名称也会在内容选项卡和命名范围部分中显示
现在,导航到“自定义”选项卡,在名称字段中输入“Total Sales”,然后选中“链接到内容”复选框
值字段显示您创建的自定义名称
单击“添加”,该属性将出现在属性列表中,并带有链接图标,其值与单元格 Sheet1!$B$10 的值相同
每当单元格 B10 中的值更改时,“Total Sales”文档属性将自动更新以反映新值
但是,如果自定义内容链接属性无效,则在属性名称前会显示一个未链接的图标,并且只能删除该属性
单击“确定”将属性保存到工作簿中
单击“确定”将属性保存到工作簿
type=warning
注意:
在使用 SpreadJS 导入/导出 Excel 文件时,应始终维护
docProps
属性如果导入的文档有创建时间,则将使用文档的现有创建时间。否则,没有创建时间
在打开新的 Designer 时,创建时间默认设置为当前时间。单击添加新工作簿后,将更新为最新时间
在导入时,SpreadJS 使用文档的修改时间,而导出的文档修改时间更新为导出时间
当用户单击打印选项时,最后打印时间将更改为当前时间