区域分类器
区域分类器用于指定对象的格式和位置。分类器可以是图片的二维矩形、文档中的一行文本、视频中的时长等。如需定义地区,请选择与您尝试使用的内容类型相匹配的地区分类器。例如,如果您的内容是文本,您可能需要使用 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-02-24。
[null,null,["最后更新时间 (UTC):2025-02-24。"],[[["Region classifiers define the format and location of an object within a document, such as a rectangle in an image or a line of text."],["You should choose the classifier that best matches your content type, like `txt` or `line` for text."],["The Google Drive API supports various region classifiers including `rect`, `page`, `time`, `txt`, `line`, and `matrix` to pinpoint specific areas within different document types."],["Each classifier has unique properties to define the region, for instance, `rect` uses `x`, `y`, `w`, `h` to specify a rectangle's position and dimensions, while `txt` uses `o` and `l` for text offset and length."],["These classifiers enable precise identification of content for functionalities like managing comments or extracting information."]]],["Region classifiers define an object's format and location, tailored to content type. Available classifiers include `rect` (2D rectangle with x,y,w,h,mw,mh,r properties), `page` (page number with p, mp properties), `time` (video duration with t,d,md properties), `txt` (text range with o,l,ml properties), `line` (text line with n,l,ml properties), and `matrix` (matrix location with c,r,w,h,mw,mh properties). Users select a classifier that fits their content and utilizes the properties to specify the location.\n"]]