Class DocumentTab

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

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

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

// Get a specific document tab based on the tab ID.
// TODO(developer): Replace the IDs with your own.
const documentTab =
    DocumentApp.openById('123abc').getTab('123abc').asDocumentTab();

পদ্ধতি

পদ্ধতি রিটার্ন টাইপ সংক্ষিপ্ত বিবরণ
add Bookmark(position) Bookmark প্রদত্ত Position একটি Bookmark যোগ করে।
add Footer() Footer Section যদি কোন ট্যাব ফুটার বিভাগ না থাকে, তাহলে একটি ট্যাব ফুটার বিভাগ যোগ করে।
add Header() Header Section যদি কোন ট্যাব হেডার বিভাগ না থাকে, তাহলে একটি ট্যাব হেডার বিভাগ যোগ করে।
add Named Range(name, range) Named Range একটি Named Range যোগ করে, যা এমন একটি Range যার একটি নাম এবং আইডি থাকে যা পরবর্তীতে পুনরুদ্ধারের জন্য ব্যবহার করা যায়।
get Body() Body ট্যাবের Body উদ্ধার করে।
get Bookmark(id) Bookmark |null প্রদত্ত আইডি দিয়ে Bookmark পায়।
get Bookmarks() Bookmark[] ট্যাবে সমস্ত Bookmark বস্তু পায়।
get Footer() Footer Section |null ট্যাবের ফুটার বিভাগটি যদি বিদ্যমান থাকে, তাহলে তা পুনরুদ্ধার করে।
get Footnotes() Footnote[] |null ট্যাবের বডিতে থাকা সমস্ত Footnote উপাদান পুনরুদ্ধার করে।
get Header() Header Section |null ট্যাবের হেডার বিভাগটি পুনরুদ্ধার করে, যদি থাকে।
get Named Range By Id(id) Named Range |null প্রদত্ত আইডি দিয়ে Named Range পায়।
get Named Ranges() Named Range[] ট্যাবে সমস্ত Named Range বস্তু পায়।
get Named Ranges(name) Named Range[] প্রদত্ত নামের সাথে ট্যাবে সমস্ত Named Range বস্তু পায়।
new Position(element, offset) Position একটি নতুন Position তৈরি করে, যা ট্যাবের একটি অবস্থানের একটি রেফারেন্স, একটি নির্দিষ্ট উপাদানের সাপেক্ষে।
new Range() Range Builder ট্যাব উপাদান থেকে Range অবজেক্ট তৈরি করতে ব্যবহৃত একটি বিল্ডার তৈরি করে।

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

add Bookmark(position)

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

// Opens the Docs file and retrieves the tab by its IDs. If you created your
// script from within a Google Docs file, you can use
// DocumentApp.getActiveDocument().getActiveTab() instead.
// TODO(developer): Replace the IDs with your own.
const documentTab =
    DocumentApp.openById('123abc').getTab('123abc').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

add Footer()

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

// Opens the Docs file and retrieves the tab by its IDs. If you created your
// script from within a Google Docs file, you can use
// DocumentApp.getActiveDocument().getActiveTab() instead.
// TODO(developer): Replace the IDs with your own.
const documentTab =
    DocumentApp.openById('123abc').getTab('123abc').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');

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

Footer Section — ট্যাবের পাদচরণ।

অনুমোদন

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

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

add Header()

যদি কোন ট্যাব হেডার বিভাগ না থাকে, তাহলে একটি ট্যাব হেডার বিভাগ যোগ করে।

// Opens the Docs file and retrieves the tab by its IDs. If you created your
// script from within a Google Docs file, you can use
// DocumentApp.getActiveDocument().getActiveTab() instead.
// TODO(developer): Replace the IDs with your own.
const documentTab =
    DocumentApp.openById('123abc').getTab('123abc').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');

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

Header Section — ট্যাব হেডার।

অনুমোদন

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

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

add Named Range(name, range)

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

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

// Creates a named range that includes every table in a tab by its ID.
// TODO(developer): Replace the IDs with your own.
const documentTab =
    DocumentApp.openById('123abc').getTab('123abc').asDocumentTab();
const rangeBuilder = documentTab.newRange();
const tables = documentTab.getBody().getTables();
for (let i = 0; i < tables.length; i++) {
  rangeBuilder.addElement(tables[i]);
}
documentTab.addNamedRange('Tab t.0 tables', rangeBuilder.build());

পরামিতি

নাম আদর্শ বিবরণ
name String পরিসরের নাম, যা অনন্য হতে হবে না; পরিসরের নাম ১-২৫৬ অক্ষরের মধ্যে হতে হবে।
range Range নামের সাথে যুক্ত করার জন্য উপাদানের পরিসর; পরিসরটি একটি অনুসন্ধান ফলাফল হতে পারে অথবা new Range() দিয়ে ম্যানুয়ালি তৈরি করা যেতে পারে।

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

Named RangeNamed Range

অনুমোদন

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

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

get Body()

ট্যাবের Body উদ্ধার করে।

ট্যাবগুলিতে বিভিন্ন ধরণের বিভাগ থাকতে পারে (উদাহরণস্বরূপ, Header Section , Footer Section )। একটি ট্যাবের সক্রিয় বিভাগ হল Body

Document Tab এলিমেন্ট পদ্ধতিগুলি Body প্রতিনিধিত্ব করে।

// Opens the Docs file and retrieves the tab by its IDs. If you created your
// script from within a Google Docs file, you can use
// DocumentApp.getActiveDocument().getActiveTab() instead.
// TODO(developer): Replace the IDs with your own.
const documentTab =
    DocumentApp.openById('123abc').getTab('123abc').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

get Bookmark(id)

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

// Opens the Docs file and retrieves the tab by its IDs. If you created your
// script from within a Google Docs file, you can use
// DocumentApp.getActiveDocument().getActiveTab() instead.
// TODO(developer): Replace the IDs with your own.
const documentTab =
    DocumentApp.openById('123abc').getTab('123abc').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 |null — প্রদত্ত আইডি সহ Bookmark , অথবা ট্যাবের মধ্যে যদি এমন কোনও Bookmark না থাকে তবে null

অনুমোদন

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

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

get Bookmarks()

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

// Opens the Docs file and retrieves the tab by its IDs. If you created your
// script from within a Google Docs file, you can use
// DocumentApp.getActiveDocument().getActiveTab() instead.
// TODO(developer): Replace the IDs with your own.
const documentTab =
    DocumentApp.openById('123abc').getTab('123abc').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

get Footer()

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

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

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

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

Footer Section |null — ট্যাবের পাদলেখ।

অনুমোদন

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

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

get Footnotes()

ট্যাবের বডিতে থাকা সমস্ত Footnote উপাদান পুনরুদ্ধার করে।

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

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

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

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

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

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

অনুমোদন

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

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

get Header()

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

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

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

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

Header Section |null — ট্যাবের হেডার।

অনুমোদন

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

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

get Named Range By Id(id)

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

পরামিতি

নাম আদর্শ বিবরণ
id String রেঞ্জের আইডি, যা ট্যাবের মধ্যে অনন্য।

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

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

অনুমোদন

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

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

get Named Ranges()

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

ট্যাব অ্যাক্সেস করে এমন যেকোনো স্ক্রিপ্টের মাধ্যমে একটি Named Range অ্যাক্সেস করা যেতে পারে। স্ক্রিপ্টগুলির মধ্যে অনিচ্ছাকৃত দ্বন্দ্ব এড়াতে, একটি অনন্য স্ট্রিং দিয়ে পরিসরের নামের আগে যোগ করার কথা বিবেচনা করুন।

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

Named Range[] — ট্যাবে Named Range বস্তুর একটি অ্যারে, সম্ভবত একই নামের একাধিক পরিসর অন্তর্ভুক্ত।

অনুমোদন

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

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

get Named Ranges(name)

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

ট্যাব অ্যাক্সেস করে এমন যেকোনো স্ক্রিপ্টের মাধ্যমে একটি Named Range অ্যাক্সেস করা যেতে পারে। স্ক্রিপ্টগুলির মধ্যে অনিচ্ছাকৃত দ্বন্দ্ব এড়াতে, একটি অনন্য স্ট্রিং দিয়ে পরিসরের নামের আগে যোগ করার কথা বিবেচনা করুন।

পরামিতি

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

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

Named Range[] — প্রদত্ত নাম সহ ট্যাবে Named Range বস্তুর একটি অ্যারে।

অনুমোদন

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

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

new Position(element, offset)

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

// Append a paragraph, then place the user's cursor after the first word of the
// new paragraph.
// TODO(developer): Replace the IDs with your own.
const doc = DocumentApp.openById('123abc');
const documentTab = doc.getTab('123abc').asDocumentTab();
const paragraph = documentTab.getBody().appendParagraph('My new paragraph.');
const position = documentTab.newPosition(paragraph.getChild(0), 2);
doc.setCursor(position);

পরামিতি

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

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

Position — নতুন Position

অনুমোদন

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

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

new Range()

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

// Change the user's selection to a range that includes every table in the tab.
// TODO(developer): Replace the IDs with your own.
const doc = DocumentApp.openById('123abc');
const documentTab = doc.getTab('123abc').asDocumentTab();
const rangeBuilder = documentTab.newRange();
const tables = documentTab.getBody().getTables();
for (let i = 0; i < tables.length; i++) {
  rangeBuilder.addElement(tables[i]);
}
doc.setSelection(rangeBuilder.build());

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

Range Builder — নতুন বিল্ডার।

অনুমোদন

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

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