public interface SharedStrings
A workbook may contain thousands of cells containing string (non-numeric) data. Furthermore this data is very likely to be repeated across many rows or columns. The goal of implementing a single string table that is shared across the workbook is to improve performance in opening and saving the file by only reading and writing the repetitive information once.
Consider for example a workbook summarizing information for cities within various countries. There may be a column for the name of the country, a column for the name of each city in that country, and a column containing the data for each city. In this case the country name is repetitive, being duplicated in many cells. In many cases the repetition is extensive, and a tremendous savings is realized by making use of a shared string table when saving the workbook. When displaying text in the spreadsheet, the cell table will just contain an index into the string table as the value of a cell, instead of the full string.
The shared string table contains all the necessary information for displaying the string: the text, formatting properties, and phonetic properties (for East Asian languages).
(工作簿中所有工作表共享的字符串表。工作簿可能包含数千个包含字符串(非数字)数据的单元格。此外,这些数据很可能在许多行或列中重复。实现跨工作簿共享的单个字符串表的目标是通过仅读取和写入重复信息一次来提高打开和保存文件的性能。例如,考虑一个总结各国城市信息的工作簿。可能有一列是国家名称,一列是该国家每个城市的名称,还有一列包含每个城市的数据。在这种情况下,国家名称是重复的,在许多单元格中重复。在许多情况下,重复是广泛的,并且在保存工作簿时通过使用共享字符串表实现了巨大的节省。在电子表格中显示文本时,单元格表将仅包含字符串表的索引作为单元格的值,而不是完整的字符串。共享字符串表包含显示字符串所需的所有信息:文本、格式属性和语音属性(针对东亚语言)。)Modifier and Type | Method and Description |
---|---|
int |
getCount()
Return an integer representing the total count of strings in the workbook.
(返回一个整数,表示工作簿中的字符串总数。)
|
RichTextString |
getItemAt(int idx)
Return a string item by index
(按索引返回字符串项)
|
int |
getUniqueCount()
Returns an integer representing the total count of unique strings in the Shared String Table.
(返回一个整数,表示共享字符串表中唯一字符串的总数。)
|
RichTextString getItemAt(int idx)
idx
- index of item to return.
(idx - 要返回的项目的索引。)
int getCount()
int getUniqueCount()
Copyright 2021 The Apache Software Foundation or its licensors, as applicable.