Class DocumentTab

ডকুমেন্টট্যাব

একটি নথি ট্যাব, সমৃদ্ধ পাঠ্য এবং উপাদান যেমন টেবিল এবং তালিকা রয়েছে।

Document.getTabs()[tabIndex].asDocumentTab() ব্যবহার করে একটি নথি ট্যাব পুনরুদ্ধার করুন।

// Get a specific document tab based on the tab ID.
var documentTab = DocumentApp.openById('abc123456').getTab('t.0').asDocumentTab();

পদ্ধতি

পদ্ধতি রিটার্ন টাইপ সংক্ষিপ্ত বিবরণ
addBookmark(position) Bookmark প্রদত্ত Position একটি Bookmark যোগ করে।
addFooter() FooterSection একটি ট্যাব ফুটার বিভাগ যোগ করে, যদি কোনটি বিদ্যমান না থাকে।
addHeader() HeaderSection একটি ট্যাব শিরোনাম বিভাগ যোগ করে, যদি কোনটি বিদ্যমান না থাকে।
addNamedRange(name, range) NamedRange একটি NamedRange যোগ করে, যা একটি Range যার একটি নাম এবং আইডি আছে যা পরবর্তীতে পুনরুদ্ধারের জন্য ব্যবহার করা যায়।
getBody() Body ট্যাবের Body পুনরুদ্ধার করে।
getBookmark(id) Bookmark প্রদত্ত আইডি দিয়ে Bookmark পায়।
getBookmarks() Bookmark[] ট্যাবে সমস্ত Bookmark বস্তু পায়।
getFooter() FooterSection ট্যাবের ফুটার বিভাগ পুনরুদ্ধার করে, যদি একটি বিদ্যমান থাকে।
getFootnotes() Footnote[] ট্যাবের শরীরের সমস্ত Footnote উপাদান পুনরুদ্ধার করে।
getHeader() HeaderSection ট্যাবের হেডার বিভাগ পুনরুদ্ধার করে, যদি একটি বিদ্যমান থাকে।
getNamedRangeById(id) NamedRange প্রদত্ত আইডি দিয়ে NamedRange পায়।
getNamedRanges() NamedRange[] ট্যাবে সমস্ত NamedRange অবজেক্ট পায়।
getNamedRanges(name) NamedRange[] প্রদত্ত নামের সাথে ট্যাবে সমস্ত NamedRange অবজেক্ট পায়।
newPosition(element, offset) Position একটি নতুন Position তৈরি করে, যা একটি নির্দিষ্ট উপাদানের সাথে সম্পর্কিত ট্যাবে একটি অবস্থানের একটি রেফারেন্স।
newRange() RangeBuilder ট্যাব উপাদান থেকে Range অবজেক্ট তৈরি করতে ব্যবহৃত একটি নির্মাতা তৈরি করে।

বিস্তারিত ডকুমেন্টেশন

addBookmark(position)

প্রদত্ত Position একটি Bookmark যোগ করে।

// Opens the Docs file by its ID and retrieves the tab with ID 't.0'. If you created your
// script from within a Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the doc ID and the tab ID with your own.
const documentTab = DocumentApp.openById('abc123456').getTab('t.0').asDocumentTab();

// Gets the tab body and adds a paragraph.
const paragraph = documentTab.getBody().appendParagraph('My new paragraph.');

// Creates a position at the first character of the paragraph text.
const position = documentTab.newPosition(paragraph.getChild(0), 0);

// Adds a bookmark at the first character of the paragraph text.
const bookmark = documentTab.addBookmark(position);

// Logs the bookmark ID to the console.
console.log(bookmark.getId());

পরামিতি

নাম টাইপ বর্ণনা
position Position নতুন বুকমার্কের অবস্থান।

প্রত্যাবর্তন

Bookmark — নতুন বুকমার্ক।

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

addFooter()

একটি ট্যাব ফুটার বিভাগ যোগ করে, যদি কোনটি বিদ্যমান না থাকে।

// Opens the Docs file by its ID and retrieves the tab with ID 't.0'. If you created your
// script from within a Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the doc ID and the tab ID with your own.
const documentTab = DocumentApp.openById('abc123456').getTab('t.0').asDocumentTab();

// Adds a footer to the tab.
const footer = documentTab.addFooter();

// Sets the footer text to 'This is a footer.'
footer.setText('This is a footer');

প্রত্যাবর্তন

FooterSection - ট্যাব ফুটার।

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

addHeader()

একটি ট্যাব শিরোনাম বিভাগ যোগ করে, যদি কোনটি বিদ্যমান না থাকে।

// Opens the Docs file by its ID and retrieves the tab with ID 't.0'. If you created your
// script from within a Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the doc ID and the tab ID with your own.
const documentTab = DocumentApp.openById('abc123456').getTab('t.0').asDocumentTab();

// Adds a header to the tab.
const header = documentTab.addHeader();

// Sets the header text to 'This is a header.'
header.setText('This is a header');

প্রত্যাবর্তন

HeaderSection - ট্যাব হেডার।

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

addNamedRange(name, range)

একটি NamedRange যোগ করে, যা একটি Range যার একটি নাম এবং আইডি আছে যা পরবর্তীতে পুনরুদ্ধারের জন্য ব্যবহার করা যায়। নামগুলি অগত্যা অনন্য নয়, এমনকি ট্যাব জুড়েও; একই ডকুমেন্টের বিভিন্ন রেঞ্জ একই নাম শেয়ার করতে পারে, অনেকটা HTML-এর একটি ক্লাসের মতো। বিপরীতে, আইডিগুলি ডকুমেন্টের মধ্যে অনন্য, যেমন HTML-এর একটি ID। আপনি একটি NamedRange যোগ করার পরে আপনি এটি সংশোধন করতে পারবেন না, আপনি শুধুমাত্র এটি সরাতে পারেন৷

যে কোনো স্ক্রিপ্ট যা ট্যাব অ্যাক্সেস করে একটি NamedRange অ্যাক্সেস করতে পারে। স্ক্রিপ্টগুলির মধ্যে অনিচ্ছাকৃত দ্বন্দ্ব এড়াতে, একটি অনন্য স্ট্রিং সহ রেঞ্জের নামগুলি উপসর্গ করার কথা বিবেচনা করুন।

// Creates a named range that includes every table in the tab with tab ID 't.0'.
var documentTab = DocumentApp.openById('abc123456').getTab('t.0').asDocumentTab();
var rangeBuilder = documentTab.newRange();
var tables = documentTab.getBody().getTables();
for (var i = 0; i < tables.length; i++) {
  rangeBuilder.addElement(tables[i]);
}
documentTab.addNamedRange('Tab t.0 tables', rangeBuilder.build());

পরামিতি

নাম টাইপ বর্ণনা
name String পরিসরের নাম, যা অনন্য হওয়ার প্রয়োজন নেই; ব্যাপ্তির নাম অবশ্যই 1-256 অক্ষরের মধ্যে হতে হবে।
range Range নামের সাথে যুক্ত করার জন্য উপাদানের পরিসর; পরিসরটি একটি অনুসন্ধান ফলাফল হতে পারে বা ম্যানুয়ালি newRange() দিয়ে তৈরি করা যেতে পারে।

প্রত্যাবর্তন

NamedRange - NamedRange

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

getBody()

ট্যাবের Body পুনরুদ্ধার করে।

ট্যাবগুলিতে বিভিন্ন ধরণের বিভাগ থাকতে পারে (উদাহরণস্বরূপ, HeaderSection , FooterSection )। একটি ট্যাবের সক্রিয় অংশ হল Body

DocumentTab উপাদান পদ্ধতিগুলি Body প্রতিনিধিত্ব করে।

// Opens the Docs file by its ID and retrieves the tab with ID 't.0'. If you created your
// script from within a Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the doc ID and the tab ID with your own.
const documentTab = DocumentApp.openById('abc123456').getTab('t.0').asDocumentTab();

// Gets the tab body.
const body = documentTab.getBody();

// Gets the body text and logs it to the console.
console.log(body.getText());

প্রত্যাবর্তন

Body — ট্যাবের বডি সেকশন।

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

getBookmark(id)

প্রদত্ত আইডি দিয়ে Bookmark পায়। এই ট্যাবের মধ্যে এই ধরনের কোনো Bookmark না থাকলে এই পদ্ধতিটি null প্রদান করে।

// Opens the Docs file by its ID and retrieves the tab with ID 't.0'. If you created your
// script from within a Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the doc ID and the tab ID with your own.
const documentTab = DocumentApp.openById('abc123456').getTab('t.0').asDocumentTab();

// Gets the bookmark by its ID.
const bookmark = documentTab.getBookmark('id.xyz654321');

// If the bookmark exists within the tab, logs the character offset of its position to the
// console. Otherwise, logs 'No bookmark exists with the given ID.' to the console.
if (bookmark) {
  console.log(bookmark.getPosition().getOffset());
} else {
  console.log('No bookmark exists with the given ID.');
}

পরামিতি

নাম টাইপ বর্ণনা
id String Bookmark জন্য আইডি।

প্রত্যাবর্তন

Bookmark — প্রদত্ত আইডি সহ Bookmark , অথবা ট্যাবের মধ্যে এই ধরনের কোনো Bookmark বিদ্যমান না থাকলে null

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

getBookmarks()

ট্যাবে সমস্ত Bookmark বস্তু পায়।

// Opens the Docs file by its ID and retrieves the tab with ID 't.0'. If you created your
// script from within a Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the doc ID and the tab ID with your own.
const documentTab = DocumentApp.openById('abc123456').getTab('t.0').asDocumentTab();

// Gets all of the bookmarks in the tab.
const bookmarks = documentTab.getBookmarks();

// Logs the number of bookmarks in the tab to the console.
console.log(bookmarks.length);

প্রত্যাবর্তন

Bookmark[] — ট্যাবে Bookmark অবজেক্টের একটি অ্যারে।

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

getFooter()

ট্যাবের ফুটার বিভাগ পুনরুদ্ধার করে, যদি একটি বিদ্যমান থাকে।

// Opens the Docs file by its ID and retrieves the tab with ID 't.0'. If you created your
// script from within a Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the doc ID and the tab ID with your own.
const documentTab = DocumentApp.openById('abc123456').getTab('t.0').asDocumentTab();

// Gets the text of the tab's footer and logs it to the console.
console.log(documentTab.getFooter().getText());

প্রত্যাবর্তন

FooterSection - ট্যাবের ফুটার।

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

getFootnotes()

ট্যাবের শরীরের সমস্ত Footnote উপাদান পুনরুদ্ধার করে।

getFootnotes এর জন্য কল ট্যাবের উপাদানগুলির উপর একটি পুনরাবৃত্তি ঘটায়। বড় ট্যাবের জন্য, এই পদ্ধতিতে অপ্রয়োজনীয় কল এড়িয়ে চলুন।

// Opens the Docs file by its ID and retrieves the tab with ID 't.0'. If you created your
// script from within a Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the doc ID and the tab ID with your own.
const documentTab = DocumentApp.openById('abc123456').getTab('t.0').asDocumentTab();

// Gets the first footnote.
const footnote = documentTab.getFootnotes()[0];

// Logs footnote contents to the console.
console.log(footnote.getFootnoteContents().getText());

প্রত্যাবর্তন

Footnote[] — ট্যাবের পাদটীকা।

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

getHeader()

ট্যাবের হেডার বিভাগ পুনরুদ্ধার করে, যদি একটি বিদ্যমান থাকে।

// Opens the Docs file by its ID and retrieves the tab with ID 't.0'. If you created your
// script from within a Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the doc ID and the tab ID with your own.
const documentTab = DocumentApp.openById('abc123456').getTab('t.0').asDocumentTab();

// Gets the text of the tab's header and logs it to the console.
console.log(documentTab.getHeader().getText());

প্রত্যাবর্তন

HeaderSection - ট্যাবের হেডার।

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

getNamedRangeById(id)

প্রদত্ত আইডি দিয়ে NamedRange পায়। এই পদ্ধতিটি null প্রদান করে যদি ট্যাবে এমন কোন NamedRange না থাকে। নামগুলি অগত্যা অনন্য নয়, এমনকি ট্যাব জুড়েও; একই ডকুমেন্টের বিভিন্ন রেঞ্জ একই নাম শেয়ার করতে পারে, অনেকটা HTML-এর একটি ক্লাসের মতো। বিপরীতে, আইডিগুলি ট্যাবের মধ্যে অনন্য, যেমন HTML-এর একটি ID।

পরামিতি

নাম টাইপ বর্ণনা
id String ব্যাপ্তির আইডি, যা ট্যাবের মধ্যে অনন্য।

প্রত্যাবর্তন

NamedRange — প্রদত্ত আইডি সহ NamedRange , অথবা ট্যাবে এমন কোনো পরিসর না থাকলে null

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

getNamedRanges()

ট্যাবে সমস্ত NamedRange অবজেক্ট পায়।

একটি NamedRange ট্যাব অ্যাক্সেস করে এমন যেকোনো স্ক্রিপ্ট দ্বারা অ্যাক্সেস করা যেতে পারে। স্ক্রিপ্টগুলির মধ্যে অনিচ্ছাকৃত দ্বন্দ্ব এড়াতে, একটি অনন্য স্ট্রিং সহ রেঞ্জের নামগুলি উপসর্গ করার কথা বিবেচনা করুন।

প্রত্যাবর্তন

NamedRange[] — ট্যাবে NamedRange অবজেক্টের একটি অ্যারে, সম্ভবত একই নামের একাধিক রেঞ্জ সহ।

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

getNamedRanges(name)

প্রদত্ত নামের সাথে ট্যাবে সমস্ত NamedRange অবজেক্ট পায়। নামগুলি অগত্যা অনন্য নয়, এমনকি ট্যাব জুড়েও; একই ডকুমেন্টের বিভিন্ন রেঞ্জ একই নাম শেয়ার করতে পারে, অনেকটা HTML-এর একটি ক্লাসের মতো। বিপরীতে, আইডিগুলি ট্যাবের মধ্যে অনন্য, যেমন HTML-এর একটি ID।

একটি NamedRange ট্যাব অ্যাক্সেস করে এমন যেকোনো স্ক্রিপ্ট দ্বারা অ্যাক্সেস করা যেতে পারে। স্ক্রিপ্টগুলির মধ্যে অনিচ্ছাকৃত দ্বন্দ্ব এড়াতে, একটি অনন্য স্ট্রিং সহ রেঞ্জের নামগুলি উপসর্গ করার কথা বিবেচনা করুন।

পরামিতি

নাম টাইপ বর্ণনা
name String পরিসরের নাম, যা অগত্যা অনন্য নয়।

প্রত্যাবর্তন

NamedRange[] — প্রদত্ত নামের ট্যাবে NamedRange অবজেক্টের একটি অ্যারে।

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

newPosition(element, offset)

একটি নতুন Position তৈরি করে, যা একটি নির্দিষ্ট উপাদানের সাথে সম্পর্কিত ট্যাবে একটি অবস্থানের একটি রেফারেন্স। ব্যবহারকারীর কার্সার অন্যান্য ব্যবহারের মধ্যে একটি Position হিসাবে উপস্থাপিত হয়।

// Append a paragraph, then place the user's cursor after the first word of the new paragraph.
var doc = DocumentApp.openById('abc123456');
var documentTab = doc.getTab('t.0').asDocumentTab();
var paragraph = documentTab.getBody().appendParagraph('My new paragraph.');
var position = documentTab.newPosition(paragraph.getChild(0), 2);
doc.setCursor(position);

পরামিতি

নাম টাইপ বর্ণনা
element Element যে উপাদানটিতে সদ্য নির্মিত Position আছে; এটি অবশ্যই একটি Text উপাদান বা Paragraph মতো একটি ধারক উপাদান হতে হবে।
offset Integer Text উপাদানগুলির জন্য, Position আগে অক্ষরের সংখ্যা; অন্যান্য উপাদানের জন্য, একই ধারক উপাদানের মধ্যে Position আগে চাইল্ড উপাদানের সংখ্যা।

প্রত্যাবর্তন

Position - নতুন Position

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents

newRange()

ট্যাব উপাদান থেকে Range অবজেক্ট তৈরি করতে ব্যবহৃত একটি নির্মাতা তৈরি করে।

// Change the user's selection to a range that includes every table in the tab.
var doc = DocumentApp.openById('abc123456');
var documentTab = doc.getTab('t.0').asDocumentTab();
var rangeBuilder = documentTab.newRange();
var tables = documentTab.getBody().getTables();
for (var i = 0; i < tables.length; i++) {
  rangeBuilder.addElement(tables[i]);
}
doc.setSelection(rangeBuilder.build());

প্রত্যাবর্তন

RangeBuilder — নতুন নির্মাতা।

অনুমোদন

যে স্ক্রিপ্টগুলি এই পদ্ধতিটি ব্যবহার করে তাদের নিম্নলিখিত এক বা একাধিক সুযোগের সাথে অনুমোদনের প্রয়োজন হয়:

  • https://www.googleapis.com/auth/documents.currentonly
  • https://www.googleapis.com/auth/documents