区域分类器
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
区域分类器用于指定对象的格式和位置。分类器可以是图像的二维矩形、文档中的一行文字、视频中的一段时间等。如需定义地区,请选择与您要使用的内容类型相匹配的地区分类器。例如,如果您的内容是文本,您可能会使用 txt
或 line
区域分类器。如需查看地区分类器的示例,请参阅管理评论和回复。
以下是 Google Drive API 随附的地区分类器列表:
rect
二维图片中的矩形。
属性 |
说明 |
类型 |
x |
x 轴上的位置,单位默认为像素(对于图片)和百分比(对于 PDF)。 |
双精度 |
y |
y 轴上的位置,单位默认为像素(对于图片)和百分比(对于 PDF)。 |
双精度 |
w |
x 轴上的长度,单位默认为像素(对于图片)和百分比(对于 PDF)。 |
双精度 |
h |
y 轴上的长度,单位默认为像素(对于图片)和百分比(对于 PDF)。 |
双精度 |
mw |
发表评论时文档的完整宽度。使用此属性可使 x 和 w 成为无单位值,因为它们可以像百分比一样发挥作用。 |
双精度 |
mh |
发表评论时文档的完整高度。如需了解用途,请参阅上文的 mw 。 |
双精度 |
r |
文档的旋转角度。例如,如果图片顺时针旋转 90 度,则位于 0,0 的矩形会显示在图片的右上角。应为 0、90、180、270 之一。 |
双精度 |
page
PDF、TIFF 或其他包含页面的文档中的页码。适用于包含类似页面的元素(例如电子表格、幻灯片或图层)的文档。
属性 |
说明 |
类型 |
p |
页码(从 0 开始的索引)。 |
整数 |
mp |
相应文档中的页数。 |
整数 |
time
视频或其他具有时间维度的文档中的时间段。
属性 |
说明 |
类型 |
t |
开始时间。 |
hh:MM:ss.frac 格式的时间字符串(其中 M = 分钟,m = 毫秒;小时和分钟是可选的) |
d |
时间范围的时长。 |
hh:MM:ss:mmm 格式化后的时间字符串(其中 M = 分钟,m = 毫秒) |
md |
文档的完整时长。 |
hh:MM:ss:mmm 格式化后的时间字符串(其中 M = 分钟,m = 毫秒) |
txt
文档中的一段文本。
属性 |
说明 |
类型 |
o |
起始偏移量(从文件开头开始的字符偏移量)。 |
整数 |
l |
文本范围的长度。 |
整数 |
ml |
相应文档的长度(以字符为单位)。 |
整数 |
line
文本文件或任何包含行的文件中的特定行。
属性 |
说明 |
类型 |
n |
行号。 |
整数 |
l |
行范围的长度。 |
整数 |
ml |
文件中的最大行数。 |
整数 |
matrix
矩阵状结构中的位置。用于定义电子表格文档或任何其他具有行或列结构的文档中的行和列。
属性 |
说明 |
类型 |
c |
列号。 |
整数 |
r |
行号。 |
整数 |
w |
列数。 |
整数 |
h |
行数。 |
整数 |
mw |
最大宽度。 |
整数 |
mh |
最大高度。 |
整数 |
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-29。
[null,null,["最后更新时间 (UTC):2025-08-29。"],[],[],null,["# Region classifiers\n\nA region classifier specifies the format and location for an object. A\nclassifier might be a 2-dimensional rectangle for an image, a line of text in a\ndocument, a time duration in a video, and so on. To define a region, select the\nregion classifier that matches the type of content you're trying to use. For\nexample, if your content is text, you're likely going to use either the `txt`\nor `line` region classifier. To see an example of a region classifier, see\n[Manage comments and\nreplies](https://developers.google.com/workspace/drive/api/guides/manage-comments#define).\n\nThe following is a list of the region classifiers included with the\nGoogle Drive API:\n\n`rect`\n\n: A rectangle in a 2-dimensional image.\n\n | Property | Description | Type |\n |----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------|\n | `x` | Position on the x axis, units default to pixels for images and percent for PDFs. | Double |\n | `y` | Position on the y axis, units default to pixels for images and percent for PDFs. | Double |\n | `w` | Length on the x axis, units default to pixels for images and percent for PDFs. | Double |\n | `h` | Length on the y axis, units default to pixels for images and percent for PDFs. | Double |\n | `mw` | The full width of the document when the comment was made. Use this to make `x` and `w` unitless since they can act like a percentage. | Double |\n | `mh` | The full height of the document when the comment was made. See `mw` above for purpose. | Double |\n | `r` | The degrees of rotation of the document. For example, if an image is rotated 90 degrees clockwise then a rectangle at 0,0 displays in the top right of the image. Should be one of 0, 90, 180, 270. | Double |\n\n`page`\n\n: A page number in a PDF, TIFF, or other document with pages. Use this for documents with page-like elements (such as a spreadsheet, slide, or layer).\n\n | Property | Description | Type |\n |----------|---------------------------------------|---------|\n | `p` | The page number (0-indexed). | Integer |\n | `mp` | The number of pages in this document. | Integer |\n\n`time`\n\n: A duration of time in a video or other document with a time dimension.\n\n | Property | Description | Type |\n |----------|-----------------------------------------|-------------------------------------------------------------------------------------------------------|\n | `t` | The start time. | `hh:MM:ss.frac` formatted time string (where M = minutes, m = millis; hours and minutes are optional) |\n | `d` | The duration of the time range. | `hh:MM:ss:mmm` formatted time string (where M = minutes, m = millis) |\n | `md` | The full-time duration of the document. | `hh:MM:ss:mmm` formatted time string (where M = minutes, m = millis) |\n\n`txt`\n\n: A range of text in a document.\n\n | Property | Description | Type |\n |----------|-------------------------------------------------------------|---------|\n | `o` | Start offset (character offset from the start of the file). | Integer |\n | `l` | The length of the text range. | Integer |\n | `ml` | The length of this document in characters. | Integer |\n\n`line`\n\n: A specific line in a text file or any files with lines in it.\n\n | Property | Description | Type |\n |----------|------------------------------------------|---------|\n | `n` | Line number. | Integer |\n | `l` | The length of the line range. | Integer |\n | `ml` | The maximum number of lines in the file. | Integer |\n\n`matrix`\n\n: A location in a matrix-like structure. Used to define rows and columns in spreadsheet documents, or any other documents that have a row or column structure.\n\n | Property | Description | Type |\n |----------|------------------------|---------|\n | `c` | The column number. | Integer |\n | `r` | The row number. | Integer |\n | `w` | The number of columns. | Integer |\n | `h` | The number of rows. | Integer |\n | `mw` | The maximum width. | Integer |\n | `mh` | The maximum height. | Integer |"]]