區域分類器
區域分類器會指定物件的格式和位置。分類器可能是圖片的 2D 矩形、文件中的一行文字、影片的時間長度等等。如要定義區域,請選取與您要使用的內容類型相符的區域分類器。舉例來說,如果您的內容是文字,您可能會使用 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-02-24 (世界標準時間)。
[null,null,["上次更新時間: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"]]