區域分類器
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
區域分類器會指定物件的格式和位置。分類器可以是圖片的二維矩形、文件中的一行文字、影片中的時間長度等。如要定義區域,請選取與要使用的內容類型相符的區域分類器。舉例來說,如果內容是文字,您可能會使用 txt
或 line
區域分類器。如要查看區域分類器範例,請參閱「管理留言和回覆」一文。
以下是 Google Drive API 隨附的區域分類器清單:
rect
2D 圖片中的矩形。
屬性 |
說明 |
類型 |
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 |
最大高度。 |
整數 |
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-08-29 (世界標準時間)。
[null,null,["上次更新時間: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 |"]]