Class Text

টেক্সট

একটি সমৃদ্ধ পাঠ্য অঞ্চলের প্রতিনিধিত্বকারী একটি উপাদান। একটি Document সমস্ত পাঠ্য Text উপাদানের মধ্যে অন্তর্ভুক্ত থাকে। একটি Text উপাদান একটি Equation , Equation Function , List Item , বা Paragraph মধ্যে অন্তর্ভুক্ত থাকতে পারে, কিন্তু অন্য কোনও উপাদান ধারণ করতে পারে না। নথির কাঠামো সম্পর্কে আরও তথ্যের জন্য, Google Docs প্রসারিত করার নির্দেশিকা দেখুন।

// Gets the body contents of the active tab.
const body =
    DocumentApp.getActiveDocument().getActiveTab().asDocumentTab().getBody();

// Use editAsText to obtain a single text element containing
// all the characters in the tab.
const text = body.editAsText();

// Insert text at the beginning of the tab.
text.insertText(0, 'Inserted text.\n');

// Insert text at the end of the tab.
text.appendText('\nAppended text.');

// Make the first half of the tab blue.
text.setForegroundColor(0, text.getText().length / 2, '#00FFFF');

পদ্ধতি

পদ্ধতি রিটার্ন টাইপ সংক্ষিপ্ত বিবরণ
append Text(text) Text এই টেক্সট অঞ্চলের শেষে নির্দিষ্ট টেক্সট যোগ করে।
copy() Text বর্তমান এলিমেন্টের একটি বিচ্ছিন্ন, গভীর অনুলিপি প্রদান করে।
delete Text(startOffset, endOffsetInclusive) Text টেক্সটের একটি পরিসর মুছে ফেলে।
edit As Text() Text সম্পাদনার জন্য বর্তমান উপাদানের একটি Text সংস্করণ পায়।
find Text(searchPattern) Range Element |null রেগুলার এক্সপ্রেশন ব্যবহার করে নির্দিষ্ট টেক্সট প্যাটার্নের জন্য এলিমেন্টের বিষয়বস্তু অনুসন্ধান করে।
find Text(searchPattern, from) Range Element |null একটি প্রদত্ত অনুসন্ধান ফলাফল থেকে শুরু করে, নির্দিষ্ট টেক্সট প্যাটার্নের জন্য উপাদানের বিষয়বস্তু অনুসন্ধান করে।
get Attributes() Object উপাদানের বৈশিষ্ট্যগুলি পুনরুদ্ধার করে।
get Attributes(offset) Object নির্দিষ্ট অক্ষর অফসেটে বৈশিষ্ট্যগুলি পুনরুদ্ধার করে।
get Background Color() String|null পটভূমির রঙের সেটিং পুনরুদ্ধার করে।
get Background Color(offset) String|null নির্দিষ্ট অক্ষর অফসেটে পটভূমির রঙ পুনরুদ্ধার করে।
get Font Family() String|null ফন্ট ফ্যামিলি সেটিং পুনরুদ্ধার করে।
get Font Family(offset) String|null নির্দিষ্ট অক্ষর অফসেটে ফন্ট পরিবার পুনরুদ্ধার করে।
get Font Size() Number|null ফন্ট সাইজ সেটিং পুনরুদ্ধার করে।
get Font Size(offset) Number|null নির্দিষ্ট অক্ষর অফসেটে ফন্টের আকার পুনরুদ্ধার করে।
get Foreground Color() String|null ফোরগ্রাউন্ড কালার সেটিং পুনরুদ্ধার করে।
get Foreground Color(offset) String|null নির্দিষ্ট অক্ষর অফসেটে অগ্রভাগের রঙ পুনরুদ্ধার করে।
get Link Url() String|null লিঙ্কের URL উদ্ধার করে।
get Link Url(offset) String|null নির্দিষ্ট অক্ষর অফসেটে লিঙ্ক URL পুনরুদ্ধার করে।
get Next Sibling() Element |null এলিমেন্টের পরবর্তী সিবলিং এলিমেন্ট উদ্ধার করে।
get Parent() Container Element |null এলিমেন্টের প্যারেন্ট এলিমেন্ট উদ্ধার করে।
get Previous Sibling() Element |null এলিমেন্টের পূর্ববর্তী ভাইবোন এলিমেন্ট উদ্ধার করে।
get Text() String এলিমেন্টের বিষয়বস্তু একটি টেক্সট স্ট্রিং হিসেবে উদ্ধার করে।
get Text Alignment() Text Alignment |null টেক্সট অ্যালাইনমেন্ট পায়।
get Text Alignment(offset) Text Alignment |null একটি একক অক্ষরের জন্য পাঠ্য সারিবদ্ধকরণ পায়।
get Text Attribute Indices() Integer[] স্বতন্ত্র টেক্সট ফর্ম্যাটিং রানের শুরুর সাথে সম্পর্কিত টেক্সট সূচকের সেট পুনরুদ্ধার করে।
get Type() Element Type উপাদানটির Element Type উদ্ধার করে।
insert Text(offset, text) Text প্রদত্ত অক্ষর অফসেটে নির্দিষ্ট টেক্সট সন্নিবেশ করায়।
is At Document End() Boolean উপাদানটি Document শেষে আছে কিনা তা নির্ধারণ করে।
is Bold() Boolean|null বোল্ড সেটিং পুনরুদ্ধার করে।
is Bold(offset) Boolean|null নির্দিষ্ট অক্ষর অফসেটে বোল্ড সেটিং পুনরুদ্ধার করে।
is Italic() Boolean|null ইটালিক সেটিং পুনরুদ্ধার করে।
is Italic(offset) Boolean|null নির্দিষ্ট অক্ষর অফসেটে ইটালিক সেটিং পুনরুদ্ধার করে।
is Strikethrough() Boolean|null স্ট্রাইকথ্রু সেটিং পুনরুদ্ধার করে।
is Strikethrough(offset) Boolean|null নির্দিষ্ট অক্ষর অফসেটে স্ট্রাইকথ্রু সেটিং পুনরুদ্ধার করে।
is Underline() Boolean|null আন্ডারলাইন সেটিং পুনরুদ্ধার করে।
is Underline(offset) Boolean|null নির্দিষ্ট অক্ষর অফসেটে আন্ডারলাইন সেটিং পুনরুদ্ধার করে।
merge() Text |null একই ধরণের পূর্ববর্তী ভাইবোনের সাথে উপাদানটিকে মার্জ করে।
remove From Parent() Text |null উপাদানটিকে তার মূল উপাদান থেকে সরিয়ে দেয়।
replace Text(searchPattern, replacement) Element রেগুলার এক্সপ্রেশন ব্যবহার করে, একটি প্রদত্ত টেক্সট প্যাটার্নের সমস্ত ঘটনাকে একটি প্রদত্ত প্রতিস্থাপন স্ট্রিং দিয়ে প্রতিস্থাপন করে।
set Attributes(startOffset, endOffsetInclusive, attributes) Text প্রদত্ত অক্ষর পরিসরে নির্দিষ্ট বৈশিষ্ট্যগুলি প্রয়োগ করে।
set Attributes(attributes) Text এলিমেন্টের বৈশিষ্ট্য নির্ধারণ করে।
set Background Color(startOffset, endOffsetInclusive, color) Text নির্দিষ্ট অক্ষর পরিসরের জন্য পটভূমির রঙ সেট করে।
set Background Color(color) Text পটভূমির রঙ সেট করে।
set Bold(bold) Text বোল্ড সেটিং সেট করে।
set Bold(startOffset, endOffsetInclusive, bold) Text নির্দিষ্ট অক্ষর পরিসরের জন্য গাঢ় সেটিং সেট করে।
set Font Family(startOffset, endOffsetInclusive, fontFamilyName) Text নির্দিষ্ট অক্ষর পরিসরের জন্য ফন্ট পরিবার সেট করে।
set Font Family(fontFamilyName) Text ফন্ট ফ্যামিলি সেট করে।
set Font Size(startOffset, endOffsetInclusive, size) Text নির্দিষ্ট অক্ষর পরিসরের জন্য ফন্টের আকার নির্ধারণ করে।
set Font Size(size) Text ফন্টের আকার নির্ধারণ করে।
set Foreground Color(startOffset, endOffsetInclusive, color) Text নির্দিষ্ট অক্ষর পরিসরের জন্য অগ্রভাগের রঙ সেট করে।
set Foreground Color(color) Text অগ্রভাগের রঙ সেট করে।
set Italic(italic) Text ইটালিক সেটিং সেট করে।
set Italic(startOffset, endOffsetInclusive, italic) Text নির্দিষ্ট অক্ষর পরিসরের জন্য ইটালিক সেটিং সেট করে।
set Link Url(startOffset, endOffsetInclusive, url) Text নির্দিষ্ট অক্ষর পরিসরের জন্য লিঙ্ক URL সেট করে।
set Link Url(url) Text লিঙ্কের url সেট করে।
set Strikethrough(strikethrough) Text স্ট্রাইকথ্রু সেটিং সেট করে।
set Strikethrough(startOffset, endOffsetInclusive, strikethrough) Text নির্দিষ্ট অক্ষর পরিসরের জন্য স্ট্রাইকথ্রু সেটিং সেট করে।
set Text(text) Text টেক্সটের বিষয়বস্তু সেট করে।
set Text Alignment(startOffset, endOffsetInclusive, textAlignment) Text একটি প্রদত্ত অক্ষর পরিসরের জন্য পাঠ্য সারিবদ্ধকরণ সেট করে।
set Text Alignment(textAlignment) Text টেক্সট অ্যালাইনমেন্ট সেট করে।
set Underline(underline) Text আন্ডারলাইন সেটিং সেট করে।
set Underline(startOffset, endOffsetInclusive, underline) Text নির্দিষ্ট অক্ষর পরিসরের জন্য আন্ডারলাইন সেটিং সেট করে।

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

append Text(text)

এই টেক্সট অঞ্চলের শেষে নির্দিষ্ট টেক্সট যোগ করে।

// Opens the Docs file by its URL. If you created your script from within a
// Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the URL with your own.
const doc = DocumentApp.openByUrl(
    'https://docs.google.com/document/d/DOCUMENT_ID/edit',
);

// Gets the body contents of the tab by its ID.
// TODO(developer): Replace the ID with your own.
const body = doc.getTab('123abc').asDocumentTab().getBody();

// Adds the text, 'Sample body text,' to the end of the tab body.
const text = body.editAsText().appendText('Sample body text');

পরামিতি

নাম আদর্শ বিবরণ
text String সংযোজন করার জন্য লেখাটি।

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

Text — বর্তমান উপাদান।

অনুমোদন

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

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

copy()

বর্তমান এলিমেন্টের একটি বিচ্ছিন্ন, গভীর অনুলিপি প্রদান করে।

এলিমেন্টে উপস্থিত যেকোনো চাইল্ড এলিমেন্টও কপি করা হয়। নতুন এলিমেন্টের কোন প্যারেন্ট নেই।

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

Text — নতুন কপি।

অনুমোদন

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

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

delete Text(startOffset, endOffsetInclusive)

টেক্সটের একটি পরিসর মুছে ফেলে।

// Opens the Docs file by its URL. If you created your script from within a
// Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the URL with your own.
const doc = DocumentApp.openByUrl(
    'https://docs.google.com/document/d/DOCUMENT_ID/edit',
);

// Gets the body contents of the tab by its ID.
// TODO(developer): Replace the ID with your own.
const body = doc.getTab('123abc').asDocumentTab().getBody();

// Deletes the first 10 characters in the body.
const text = body.editAsText().deleteText(0, 9);

পরামিতি

নাম আদর্শ বিবরণ
start Offset Integer মুছে ফেলার জন্য প্রথম অক্ষরের অক্ষর অফসেট।
end Offset Inclusive Integer মুছে ফেলার জন্য শেষ অক্ষরের অক্ষর অফসেট।

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

Text — বর্তমান উপাদান।

অনুমোদন

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

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

edit As Text()

সম্পাদনার জন্য বর্তমান উপাদানের একটি Text সংস্করণ পায়।

এলিমেন্টের কন্টেন্টগুলিকে রিচ টেক্সট হিসেবে ব্যবহার করার জন্য edit As Text ব্যবহার করুন। edit As Text মোড নন-টেক্সট এলিমেন্টগুলিকে (যেমন Inline Image এবং Horizontal Rule ) উপেক্ষা করে।

মুছে ফেলা টেক্সট রেঞ্জের মধ্যে সম্পূর্ণরূপে থাকা চাইল্ড এলিমেন্টগুলি এলিমেন্ট থেকে সরানো হয়।

const body =
    DocumentApp.getActiveDocument().getActiveTab().asDocumentTab().getBody();

// Insert two paragraphs separated by a paragraph containing an
// horizontal rule.
body.insertParagraph(0, 'An editAsText sample.');
body.insertHorizontalRule(0);
body.insertParagraph(0, 'An example.');

// Delete " sample.\n\n An" removing the horizontal rule in the process.
body.editAsText().deleteText(14, 25);

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

Text — বর্তমান এলিমেন্টের একটি টেক্সট ভার্সন


find Text(searchPattern)

রেগুলার এক্সপ্রেশন ব্যবহার করে নির্দিষ্ট টেক্সট প্যাটার্নের জন্য এলিমেন্টের বিষয়বস্তু অনুসন্ধান করে।

জাভাস্ক্রিপ্ট রেগুলার এক্সপ্রেশন বৈশিষ্ট্যগুলির একটি উপসেট সম্পূর্ণরূপে সমর্থিত নয়, যেমন ক্যাপচার গ্রুপ এবং মোড মডিফায়ার।

প্রদত্ত রেগুলার এক্সপ্রেশন প্যাটার্নটি বর্তমান এলিমেন্টে থাকা প্রতিটি টেক্সট ব্লকের সাথে স্বাধীনভাবে মিলে যায়।

পরামিতি

নাম আদর্শ বিবরণ
search Pattern String যে প্যাটার্নটি খুঁজতে হবে

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

Range Element |null — একটি সার্চ ফলাফল যা সার্চ টেক্সটের অবস্থান নির্দেশ করে, অথবা যদি কোন মিল না থাকে তাহলে নাল

অনুমোদন

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

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

find Text(searchPattern, from)

একটি প্রদত্ত অনুসন্ধান ফলাফল থেকে শুরু করে, নির্দিষ্ট টেক্সট প্যাটার্নের জন্য উপাদানের বিষয়বস্তু অনুসন্ধান করে।

জাভাস্ক্রিপ্ট রেগুলার এক্সপ্রেশন বৈশিষ্ট্যগুলির একটি উপসেট সম্পূর্ণরূপে সমর্থিত নয়, যেমন ক্যাপচার গ্রুপ এবং মোড মডিফায়ার।

প্রদত্ত রেগুলার এক্সপ্রেশন প্যাটার্নটি বর্তমান এলিমেন্টে থাকা প্রতিটি টেক্সট ব্লকের সাথে স্বাধীনভাবে মিলে যায়।

পরামিতি

নাম আদর্শ বিবরণ
search Pattern String যে প্যাটার্নটি খুঁজতে হবে
from Range Element যে অনুসন্ধান ফলাফল থেকে অনুসন্ধান করা হবে

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

Range Element |null — একটি সার্চ রেজাল্ট যা সার্চ টেক্সটের পরবর্তী অবস্থান নির্দেশ করে, অথবা যদি কোন মিল না থাকে তাহলে নাল।

অনুমোদন

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

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

get Attributes()

উপাদানের বৈশিষ্ট্যগুলি পুনরুদ্ধার করে।

ফলাফল হল প্রতিটি বৈধ উপাদান বৈশিষ্ট্যের জন্য একটি বৈশিষ্ট্য ধারণকারী একটি বস্তু যেখানে প্রতিটি বৈশিষ্ট্যের নাম Document App.Attribute একটি আইটেমের সাথে মিলে যায়। অ্যাট্রিবিউট গণনা।

const doc = DocumentApp.getActiveDocument();
const documentTab = doc.getActiveTab().asDocumentTab();
const body = documentTab.getBody();

// Append a styled paragraph.
const par = body.appendParagraph('A bold, italicized paragraph.');
par.setBold(true);
par.setItalic(true);

// Retrieve the paragraph's attributes.
const atts = par.getAttributes();

// Log the paragraph attributes.
for (const att in atts) {
  Logger.log(`${att}:${atts[att]}`);
}

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

Object — উপাদানের বৈশিষ্ট্য।

অনুমোদন

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

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

get Attributes(offset)

নির্দিষ্ট অক্ষর অফসেটে বৈশিষ্ট্যগুলি পুনরুদ্ধার করে।

ফলাফল হল প্রতিটি বৈধ টেক্সট অ্যাট্রিবিউটের জন্য একটি প্রোপার্টি সম্বলিত একটি অবজেক্ট যেখানে প্রতিটি প্রোপার্টির নাম Document App.Attribute একটি আইটেমের সাথে মিলে যায়। অ্যাট্রিবিউট গণনা।

// Opens the Docs file by its URL. If you created your script from within a
// Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the URL with your own.
const doc = DocumentApp.openByUrl(
    'https://docs.google.com/document/d/DOCUMENT_ID/edit',
);

// Gets the body contents of the tab by its ID.
// TODO(developer): Replace the ID with your own.
const body = doc.getTab('123abc').asDocumentTab().getBody();

// Declares style attributes.
const style = {};
style[DocumentApp.Attribute.BOLD] = true;
style[DocumentApp.Attribute.ITALIC] = true;
style[DocumentApp.Attribute.FONT_SIZE] = 29;

// Sets the style attributes to the tab's body.
const text = body.editAsText();
text.setAttributes(style);

// Gets the style attributes applied to the eleventh character in the
// body and logs them to the console.
const attributes = text.getAttributes(10);
console.log(attributes);

পরামিতি

নাম আদর্শ বিবরণ
offset Integer চরিত্রটি অফসেট।

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

Object — উপাদানের বৈশিষ্ট্য।

অনুমোদন

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

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

get Background Color()

পটভূমির রঙের সেটিং পুনরুদ্ধার করে।

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

String|null — ব্যাকগ্রাউন্ড কালার, CSS নোটেশনে ফরম্যাট করা (যেমন '#ffffff' ), অথবা null যদি এলিমেন্টটিতে এই অ্যাট্রিবিউটের জন্য একাধিক মান থাকে।

অনুমোদন

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

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

get Background Color(offset)

নির্দিষ্ট অক্ষর অফসেটে পটভূমির রঙ পুনরুদ্ধার করে।

// Opens the Docs file by its URL. If you created your script from within a
// Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the URL with your own.
const doc = DocumentApp.openByUrl(
    'https://docs.google.com/document/d/DOCUMENT_ID',
);

// Gets the body contents of the tab by its ID.
// TODO(developer): Replace the ID with your own.
const body = doc.getTab('123abc').asDocumentTab().getBody();

// Sets the background color of the first 3 characters in the body.
const text = body.editAsText().setBackgroundColor(0, 2, '#FFC0CB');

// Gets the background color of the first character in the body.
const backgroundColor = text.getBackgroundColor(0);

// Logs the background color to the console.
console.log(backgroundColor);

পরামিতি

নাম আদর্শ বিবরণ
offset Integer চরিত্রটি অফসেট।

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

String|null — পটভূমির রঙ, CSS নোটেশনে ফরম্যাট করা (যেমন '#ffffff' )।

অনুমোদন

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

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

get Font Family()

ফন্ট ফ্যামিলি সেটিং পুনরুদ্ধার করে। নামটি ডক্স বা গুগল ফন্টের ফন্ট মেনু থেকে যেকোনো ফন্ট হতে পারে এবং কেস-সংবেদনশীল। পদ্ধতিগুলি get Font Family() এবং set Font Family(fontFamilyName) এখন Font Family enum এর পরিবর্তে ফন্টের জন্য স্ট্রিং নাম ব্যবহার করে। যদিও এই enumটি অবচিত, এটি পুরানো স্ক্রিপ্টগুলির সাথে সামঞ্জস্যের জন্য উপলব্ধ থাকবে।

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

String|null — ফন্ট ফ্যামিলি, অথবা null যদি এলিমেন্টটিতে এই অ্যাট্রিবিউটের জন্য একাধিক মান থাকে।

অনুমোদন

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

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

get Font Family(offset)

নির্দিষ্ট অক্ষর অফসেটে ফন্ট ফ্যামিলি পুনরুদ্ধার করে। নামটি ডক্স বা গুগল ফন্টের ফন্ট মেনু থেকে যেকোনো ফন্ট হতে পারে এবং কেস-সংবেদনশীল। পদ্ধতিগুলি get Font Family() এবং set Font Family(fontFamilyName) এখন Font Family enum এর পরিবর্তে ফন্টের জন্য স্ট্রিং নাম ব্যবহার করে। যদিও এই enumটি অবচিত, এটি পুরানো স্ক্রিপ্টগুলির সাথে সামঞ্জস্যের জন্য উপলব্ধ থাকবে।

// Opens the Docs file by its URL. If you created your script from within a
// Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the URL with your own.
const doc = DocumentApp.openByUrl(
    'https://docs.google.com/document/d/DOCUMENT_ID/edit',
);

// Gets the body contents of the tab by its ID.
// TODO(developer): Replace the ID with your own.
const body = doc.getTab('123abc').asDocumentTab().getBody();

// Sets the font of the first 16 characters to Impact.
const text = body.editAsText().setFontFamily(0, 15, 'Impact');

// Gets the font family of the 16th character in the tab body.
const fontFamily = text.getFontFamily(15);

// Logs the font family to the console.
console.log(fontFamily);

পরামিতি

নাম আদর্শ বিবরণ
offset Integer চরিত্রটি অফসেট।

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

String|null — ফন্ট পরিবার।

অনুমোদন

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

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

get Font Size()

ফন্ট সাইজ সেটিং পুনরুদ্ধার করে।

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

Number|null — ফন্টের আকার, অথবা যদি উপাদানটিতে এই বৈশিষ্ট্যের জন্য একাধিক মান থাকে তবে নাল

অনুমোদন

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

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

get Font Size(offset)

নির্দিষ্ট অক্ষর অফসেটে ফন্টের আকার পুনরুদ্ধার করে।

// Opens the Docs file by its URL. If you created your script from within a
// Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the URL with your own.
const doc = DocumentApp.openByUrl(
    'https://docs.google.com/document/d/DOCUMENT_ID/edit',
);

// Gets the body contents of the tab by its ID.
// TODO(developer): Replace the ID with your own.
const body = doc.getTab('123abc').asDocumentTab().getBody();

// Sets the font size of the first 13 characters to 15.
const text = body.editAsText().setFontSize(0, 12, 15);

// Gets the font size of the first character.
const fontSize = text.getFontSize(0);

// Logs the font size to the console.
console.log(fontSize);

পরামিতি

নাম আদর্শ বিবরণ
offset Integer চরিত্রটি অফসেট।

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

Number|null — ফন্টের আকার।

অনুমোদন

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

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

get Foreground Color()

ফোরগ্রাউন্ড কালার সেটিং পুনরুদ্ধার করে।

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

String|null — ফোরগ্রাউন্ড কালার, CSS নোটেশনে ফরম্যাট করা (যেমন '#ffffff' ), অথবা null যদি এলিমেন্টটিতে এই অ্যাট্রিবিউটের জন্য একাধিক মান থাকে।

অনুমোদন

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

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

get Foreground Color(offset)

নির্দিষ্ট অক্ষর অফসেটে অগ্রভাগের রঙ পুনরুদ্ধার করে।

// Opens the Docs file by its URL. If you created your script from within a
// Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the URL with your own.
const doc = DocumentApp.openByUrl(
    'https://docs.google.com/document/d/DOCUMENT_ID/edit',
);

// Gets the body contents of the tab by its ID.
// TODO(developer): Replace the ID with your own.
const body = doc.getTab('123abc').asDocumentTab().getBody();

// Sets the foreground color of the first 3 characters in the tab body.
const text = body.editAsText().setForegroundColor(0, 2, '#0000FF');

// Gets the foreground color of the first character in the tab body.
const foregroundColor = text.getForegroundColor(0);

// Logs the foreground color to the console.
console.log(foregroundColor);

পরামিতি

নাম আদর্শ বিবরণ
offset Integer চরিত্রটি অফসেট।

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

String|null — ফোরগ্রাউন্ড রঙ, CSS নোটেশনে ফর্ম্যাট করা (যেমন '#ffffff' )।

অনুমোদন

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

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

get Link Url()

লিঙ্কের URL উদ্ধার করে।

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

String|null — লিঙ্ক url, অথবা null যদি উপাদানটিতে এই বৈশিষ্ট্যের জন্য একাধিক মান থাকে

অনুমোদন

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

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

get Link Url(offset)

নির্দিষ্ট অক্ষর অফসেটে লিঙ্ক URL পুনরুদ্ধার করে।

// Opens the Docs file by its URL. If you created your script from within a
// Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the URL with your own.
const doc = DocumentApp.openByUrl(
    'https://docs.google.com/document/d/DOCUMENT_ID/edit',
);

// Gets the body contents of the tab by its ID.
// TODO(developer): Replace the ID with your own.
const body = doc.getTab('123abc').asDocumentTab().getBody();

// Applies a link to the first 10 characters in the body.
const text = body.editAsText().setLinkUrl(0, 9, 'https://www.example.com/');

// Gets the URL of the link from the first character.
const link = text.getLinkUrl(0);

// Logs the link URL to the console.
console.log(link);

পরামিতি

নাম আদর্শ বিবরণ
offset Integer চরিত্রটি অফসেট।

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

String|null — লিঙ্কের URL।

অনুমোদন

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

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

get Next Sibling()

এলিমেন্টের পরবর্তী সিবলিং এলিমেন্ট উদ্ধার করে।

পরবর্তী ভাইবোনের একই পিতামাতা আছে এবং বর্তমান উপাদানটি অনুসরণ করে।

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

Element |null — পরবর্তী সহোদর উপাদান।

অনুমোদন

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

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

get Parent()

এলিমেন্টের প্যারেন্ট এলিমেন্ট উদ্ধার করে।

প্যারেন্ট এলিমেন্টে বর্তমান এলিমেন্ট থাকে।

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

Container Element |null — মূল এলিমেন্ট।

অনুমোদন

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

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

get Previous Sibling()

এলিমেন্টের পূর্ববর্তী ভাইবোন এলিমেন্ট উদ্ধার করে।

পূর্ববর্তী ভাইবোনের একই প্যারেন্ট আছে এবং বর্তমান এলিমেন্টের আগে থাকে।

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

Element |null — পূর্ববর্তী সহোদর উপাদান।

অনুমোদন

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

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

get Text()

এলিমেন্টের বিষয়বস্তু একটি টেক্সট স্ট্রিং হিসেবে উদ্ধার করে।

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

String — টেক্সট স্ট্রিং হিসেবে এলিমেন্টের বিষয়বস্তু

অনুমোদন

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

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

get Text Alignment()

টেক্সট অ্যালাইনমেন্ট পায়। অ্যালাইনমেন্টের উপলব্ধ ধরণগুলি হল Document App.TextAlignment.NORMAL , Document App.TextAlignment.SUBSCRIPT , এবং Document App.TextAlignment.SUPERSCRIPT

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

Text Alignment |null — টেক্সট অ্যালাইনমেন্টের ধরণ, অথবা যদি টেক্সটে একাধিক ধরণের টেক্সট অ্যালাইনমেন্ট থাকে অথবা যদি টেক্সট অ্যালাইনমেন্ট কখনও সেট করা না থাকে তাহলে null

অনুমোদন

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

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

get Text Alignment(offset)

একটি একক অক্ষরের জন্য টেক্সট অ্যালাইনমেন্ট পায়। অ্যালাইনমেন্টের উপলব্ধ ধরণগুলি হল Document App.TextAlignment.NORMAL , Document App.TextAlignment.SUBSCRIPT , এবং Document App.TextAlignment.SUPERSCRIPT

// Opens the Docs file by its URL. If you created your script from within a
// Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the URL with your own.
const doc = DocumentApp.openByUrl(
    'https://docs.google.com/document/d/DOCUMENT_ID/edit',
);

// Gets the body contents of the tab by its ID.
// TODO(developer): Replace the ID with your own.
const body = doc.getTab('123abc').asDocumentTab().getBody();

// Sets the text alignment of the tab's body to NORMAL.
const text =
    body.editAsText().setTextAlignment(DocumentApp.TextAlignment.NORMAL);

// Gets the text alignment of the ninth character.
const alignment = text.getTextAlignment(8);

// Logs the text alignment to the console.
console.log(alignment.toString());

পরামিতি

নাম আদর্শ বিবরণ
offset Integer চরিত্রের অফসেট।

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

Text Alignment |null — টেক্সট অ্যালাইনমেন্টের ধরণ, অথবা যদি টেক্সট অ্যালাইনমেন্ট কখনও সেট করা না থাকে তাহলে null

অনুমোদন

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

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

get Text Attribute Indices()

স্বতন্ত্র টেক্সট ফর্ম্যাটিং রানের শুরুর সাথে সম্পর্কিত টেক্সট সূচকের সেট পুনরুদ্ধার করে।

// Opens the Docs file by its URL. If you created your script from within a
// Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the URL with your own.
const doc = DocumentApp.openByUrl(
    'https://docs.google.com/document/d/DOCUMENT_ID/edit',
);

// Gets the body contents of the tab by its ID.
// TODO(developer): Replace the ID with your own.
const body = doc.getTab('123abc').asDocumentTab().getBody();

// Gets the text indices at which text formatting changes.
const indices = body.editAsText().getTextAttributeIndices();

// Logs the indices to the console.
console.log(indices.toString());

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

Integer[] — টেক্সট সূচকের সেট যেখানে টেক্সট ফর্ম্যাটিং পরিবর্তন হয়।

অনুমোদন

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

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

get Type()

উপাদানটির Element Type উদ্ধার করে।

একটি নির্দিষ্ট উপাদানের সঠিক ধরণ নির্ধারণ করতে get Type() ব্যবহার করুন।

const doc = DocumentApp.getActiveDocument();
const documentTab = doc.getActiveTab().asDocumentTab();
const body = documentTab.getBody();

// Obtain the first element in the active tab's body.

const firstChild = body.getChild(0);

// Use getType() to determine the element's type.
if (firstChild.getType() === DocumentApp.ElementType.PARAGRAPH) {
  Logger.log('The first element is a paragraph.');
} else {
  Logger.log('The first element is not a paragraph.');
}

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

Element Type — এলিমেন্টের ধরণ।

অনুমোদন

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

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

insert Text(offset, text)

প্রদত্ত অক্ষর অফসেটে নির্দিষ্ট টেক্সট সন্নিবেশ করায়।

// Opens the Docs file by its URL. If you created your script from within a
// Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the URL with your own.
const doc = DocumentApp.openByUrl(
    'https://docs.google.com/document/d/DOCUMENT_ID/edit',
);

// Gets the body contents of the tab by its ID.
// TODO(developer): Replace the ID with your own.
const body = doc.getTab('123abc').asDocumentTab().getBody();

// Inserts the text, 'Sample inserted text', at the start of the body content.
const text = body.editAsText().insertText(0, 'Sample inserted text');

পরামিতি

নাম আদর্শ বিবরণ
offset Integer যে অক্ষরে টেক্সট সন্নিবেশ করা হবে তার অফসেট।
text String সন্নিবেশ করানোর জন্য লেখা।

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

Text — বর্তমান উপাদান।

অনুমোদন

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

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

is At Document End()

উপাদানটি Document শেষে আছে কিনা তা নির্ধারণ করে।

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

Boolean — উপাদানটি ট্যাবের শেষে আছে কিনা।

অনুমোদন

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

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

is Bold()

বোল্ড সেটিং পুনরুদ্ধার করে।

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

Boolean|null — টেক্সটটি বোল্ড কিনা, নাকি নাল যদি এলিমেন্টটিতে এই অ্যাট্রিবিউটের জন্য একাধিক মান থাকে

অনুমোদন

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

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

is Bold(offset)

নির্দিষ্ট অক্ষর অফসেটে বোল্ড সেটিং পুনরুদ্ধার করে।

// Opens the Docs file by its URL. If you created your script from within a
// Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the URL with your own.
const doc = DocumentApp.openByUrl(
    'https://docs.google.com/document/d/DOCUMENT_ID/edit',
);

// Gets the body contents of the tab by its ID.
// TODO(developer): Replace the ID with your own.
const body = doc.getTab('123abc').asDocumentTab().getBody();

// Bolds the first 4 characters in the tab body.
const text = body.editAsText().setBold(0, 3, true);

// Gets whether or not the text is bold.
const bold = text.editAsText().isBold(0);

// Logs the text's bold setting to the console
console.log(bold);

পরামিতি

নাম আদর্শ বিবরণ
offset Integer চরিত্রটি অফসেট।

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

Boolean|null — সাহসী সেটিং।

অনুমোদন

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

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

is Italic()

ইটালিক সেটিং পুনরুদ্ধার করে।

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

Boolean|null — টেক্সটটি ইটালিক কিনা, নাকি নাল যদি এলিমেন্টটিতে এই অ্যাট্রিবিউটের জন্য একাধিক মান থাকে

অনুমোদন

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

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

is Italic(offset)

নির্দিষ্ট অক্ষর অফসেটে ইটালিক সেটিং পুনরুদ্ধার করে।

// Opens the Docs file by its URL. If you created your script from within a
// Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the URL with your own.
const doc = DocumentApp.openByUrl(
    'https://docs.google.com/document/d/DOCUMENT_ID/edit',
);

// Gets the body contents of the tab by its ID.
// TODO(developer): Replace the ID with your own.
const body = doc.getTab('123abc').asDocumentTab().getBody();

// Sets the first 13 characters of the tab body to italic.
const text = body.editAsText().setItalic(0, 12, true);

// Gets whether the fifth character in the tab body is set to
// italic and logs it to the console.
const italic = text.isItalic(4);
console.log(italic);

পরামিতি

নাম আদর্শ বিবরণ
offset Integer চরিত্রটি অফসেট।

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

Boolean|null — ইটালিক সেটিং।

অনুমোদন

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

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

is Strikethrough()

স্ট্রাইকথ্রু সেটিং পুনরুদ্ধার করে।

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

Boolean|null — টেক্সটটি স্ট্রাইকথ্রু কিনা, নাকি নাল যদি এলিমেন্টটিতে এই অ্যাট্রিবিউটের জন্য একাধিক মান থাকে

অনুমোদন

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

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

is Strikethrough(offset)

নির্দিষ্ট অক্ষর অফসেটে স্ট্রাইকথ্রু সেটিং পুনরুদ্ধার করে।

// Opens the Docs file by its URL. If you created your script from within a
// Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the URL with your own.
const doc = DocumentApp.openByUrl(
    'https://docs.google.com/document/d/DOCUMENT_ID/edit',
);

// Gets the body contents of the tab by its ID.
// TODO(developer): Replace the ID with your own.
const body = doc.getTab('123abc').asDocumentTab().getBody();

// Sets the first 17 characters of the tab body to strikethrough.
const text = body.editAsText().setStrikethrough(0, 16, true);

// Gets whether the first character in the tab body is set to
// strikethrough and logs it to the console.
const strikethrough = text.isStrikethrough(0);
console.log(strikethrough);

পরামিতি

নাম আদর্শ বিবরণ
offset Integer চরিত্রটি অফসেট।

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

Boolean|null — স্ট্রাইকথ্রু সেটিং।

অনুমোদন

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

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

is Underline()

আন্ডারলাইন সেটিং পুনরুদ্ধার করে।

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

Boolean|null — টেক্সটটি আন্ডারলাইন করা আছে কিনা, নাকি নাল যদি এলিমেন্টটিতে এই অ্যাট্রিবিউটের জন্য একাধিক মান থাকে

অনুমোদন

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

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

is Underline(offset)

নির্দিষ্ট অক্ষর অফসেটে আন্ডারলাইন সেটিং পুনরুদ্ধার করে।

// Opens the Docs file by its URL. If you created your script from within a
// Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the URL with your own.
const doc = DocumentApp.openByUrl(
    'https://docs.google.com/document/d/DOCUMENT_ID/edit',
);

// Gets the body contents of the tab by its ID.
// TODO(developer): Replace the ID with your own.
const body = doc.getTab('123abc').asDocumentTab().getBody();

// Sets the first 13 characters of the tab body to underline.
const text = body.editAsText().setUnderline(0, 12, false);

// Gets whether the first character in the tab body is set to
// underline and logs it to the console
const underline = text.editAsText().isUnderline(0);
console.log(underline);

পরামিতি

নাম আদর্শ বিবরণ
offset Integer চরিত্রটি অফসেট।

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

Boolean|null — আন্ডারলাইন সেটিং।

অনুমোদন

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

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

merge()

একই ধরণের পূর্ববর্তী ভাইবোনের সাথে উপাদানটিকে মার্জ করে।

শুধুমাত্র একই Element Type এলিমেন্টগুলিকে মার্জ করা যেতে পারে। বর্তমান এলিমেন্টে থাকা যেকোনো চাইল্ড এলিমেন্ট পূর্ববর্তী সিবলিং এলিমেন্টে স্থানান্তরিত হয়।

বর্তমান উপাদানটি ডকুমেন্ট থেকে সরানো হয়েছে।

const doc = DocumentApp.getActiveDocument();
const documentTab = doc.getActiveTab().asDocumentTab();
const body = documentTab.getBody();

// Example 1: Merge paragraphs
// Append two paragraphs to the document's active tab.
const par1 = body.appendParagraph('Paragraph 1.');
const par2 = body.appendParagraph('Paragraph 2.');
// Merge the newly added paragraphs into a single paragraph.
par2.merge();

// Example 2: Merge table cells
// Create a two-dimensional array containing the table's cell contents.
const cells = [
  ['Row 1, Cell 1', 'Row 1, Cell 2'],
  ['Row 2, Cell 1', 'Row 2, Cell 2'],
];
// Build a table from the array.
const table = body.appendTable(cells);
// Get the first row in the table.
const row = table.getRow(0);
// Get the two cells in this row.
const cell1 = row.getCell(0);
const cell2 = row.getCell(1);
// Merge the current cell into its preceding sibling element.
const merged = cell2.merge();

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

Text |null — মার্জ করা উপাদান।

অনুমোদন

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

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

remove From Parent()

উপাদানটিকে তার মূল উপাদান থেকে সরিয়ে দেয়।

const doc = DocumentApp.getActiveDocument();
const documentTab = doc.getActiveTab().asDocumentTab();
const body = documentTab.getBody();

// Remove all images in the active tab's body.
const imgs = body.getImages();
for (let i = 0; i < imgs.length; i++) {
  imgs[i].removeFromParent();
}

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

Text |null — সরানো উপাদান।

অনুমোদন

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

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

replace Text(searchPattern, replacement)

রেগুলার এক্সপ্রেশন ব্যবহার করে, একটি প্রদত্ত টেক্সট প্যাটার্নের সমস্ত ঘটনাকে একটি প্রদত্ত প্রতিস্থাপন স্ট্রিং দিয়ে প্রতিস্থাপন করে।

অনুসন্ধান প্যাটার্নটি জাভাস্ক্রিপ্ট রেগুলার এক্সপ্রেশন অবজেক্ট নয়, বরং একটি স্ট্রিং হিসেবে পাস করা হয়। এর ফলে আপনাকে প্যাটার্নে যেকোনো ব্যাকস্ল্যাশ এড়াতে হবে।

এই পদ্ধতিগুলি Google এর RE2 রেগুলার এক্সপ্রেশন লাইব্রেরি ব্যবহার করে, যা সমর্থিত সিনট্যাক্সকে সীমিত করে।

প্রদত্ত রেগুলার এক্সপ্রেশন প্যাটার্নটি বর্তমান এলিমেন্টে থাকা প্রতিটি টেক্সট ব্লকের সাথে স্বাধীনভাবে মিলে যায়।

const body =
    DocumentApp.getActiveDocument().getActiveTab().asDocumentTab().getBody();

// Clear the text surrounding "Apps Script", with or without text.
body.replaceText('^.*Apps ?Script.*$', 'Apps Script');

পরামিতি

নাম আদর্শ বিবরণ
search Pattern String অনুসন্ধানের জন্য রেজেক্স প্যাটার্ন
replacement String প্রতিস্থাপন হিসেবে ব্যবহার করার জন্য লেখাটি

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

Element — বর্তমান উপাদান

অনুমোদন

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

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

set Attributes(startOffset, endOffsetInclusive, attributes)

প্রদত্ত অক্ষর পরিসরে নির্দিষ্ট বৈশিষ্ট্যগুলি প্রয়োগ করে।

নির্দিষ্ট অ্যাট্রিবিউট প্যারামিটারটি অবশ্যই এমন একটি অবজেক্ট হতে হবে যেখানে প্রতিটি প্রোপার্টির নাম Document App.Attribute একটি আইটেম। অ্যাট্রিবিউট গণনা এবং প্রতিটি প্রোপার্টির মান হল প্রয়োগ করা নতুন মান।

// Opens the Docs file by its URL. If you created your script from within a
// Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the URL with your own.
const doc = DocumentApp.openByUrl(
    'https://docs.google.com/document/d/DOCUMENT_ID/edit',
);

// Gets the body contents of the tab by its ID.
// TODO(developer): Replace the ID with your own.
const body = doc.getTab('123abc').asDocumentTab().getBody();

// Declares style attributes for font size and font family.
const style = {};
style[DocumentApp.Attribute.FONT_SIZE] = 20;
style[DocumentApp.Attribute.FONT_FAMILY] = 'Impact';

// Sets the style attributes to the first 9 characters in the tab's body.
const text = body.setAttributes(0, 8, style);

পরামিতি

নাম আদর্শ বিবরণ
start Offset Integer টেক্সট রেঞ্জের শুরুর অফসেট।
end Offset Inclusive Integer টেক্সট রেঞ্জের শেষ অফসেট।
attributes Object উপাদানটির বৈশিষ্ট্য।

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

Text — বর্তমান উপাদান।

অনুমোদন

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

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

set Attributes(attributes)

এলিমেন্টের বৈশিষ্ট্য নির্ধারণ করে।

নির্দিষ্ট অ্যাট্রিবিউট প্যারামিটারটি অবশ্যই এমন একটি অবজেক্ট হতে হবে যেখানে প্রতিটি প্রোপার্টির নাম Document App.Attribute একটি আইটেম। অ্যাট্রিবিউট গণনা এবং প্রতিটি প্রোপার্টির মান হল প্রয়োগ করা নতুন মান।

const doc = DocumentApp.getActiveDocument();
const documentTab = doc.getActiveTab().asDocumentTab();
const body = documentTab.getBody();

// Define a custom paragraph style.
const style = {};
style[DocumentApp.Attribute.HORIZONTAL_ALIGNMENT] =
    DocumentApp.HorizontalAlignment.RIGHT;
style[DocumentApp.Attribute.FONT_FAMILY] = 'Calibri';
style[DocumentApp.Attribute.FONT_SIZE] = 18;
style[DocumentApp.Attribute.BOLD] = true;

// Append a plain paragraph.
const par = body.appendParagraph('A paragraph with custom style.');

// Apply the custom style.
par.setAttributes(style);

পরামিতি

নাম আদর্শ বিবরণ
attributes Object উপাদানটির বৈশিষ্ট্য।

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

Text — বর্তমান উপাদান।

অনুমোদন

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

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

set Background Color(startOffset, endOffsetInclusive, color)

নির্দিষ্ট অক্ষর পরিসরের জন্য পটভূমির রঙ সেট করে।

// Opens the Docs file by its URL. If you created your script from within a
// Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the URL with your own.
const doc = DocumentApp.openByUrl(
    'https://docs.google.com/document/d/DOCUMENT_ID/edit',
);

// Gets the body contents of the tab by its ID.
// TODO(developer): Replace the ID with your own.
const body = doc.getTab('123abc').asDocumentTab().getBody();

// Sets the background color of the first 3 characters in the
// tab body to hex color #0000FF.
const text = body.editAsText().setBackgroundColor(0, 2, '#0000FF');

পরামিতি

নাম আদর্শ বিবরণ
start Offset Integer টেক্সট রেঞ্জের শুরুর অফসেট।
end Offset Inclusive Integer টেক্সট রেঞ্জের শেষ অফসেট।
color String পটভূমির রঙ, CSS নোটেশনে ফর্ম্যাট করা (যেমন '#ffffff' )।

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

Text — বর্তমান উপাদান।

অনুমোদন

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

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

set Background Color(color)

পটভূমির রঙ সেট করে।

পরামিতি

নাম আদর্শ বিবরণ
color String পটভূমির রঙ, CSS নোটেশনে ফর্ম্যাট করা (যেমন '#ffffff' )

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

Text — বর্তমান উপাদান

অনুমোদন

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

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

set Bold(bold)

বোল্ড সেটিং সেট করে।

পরামিতি

নাম আদর্শ বিবরণ
bold Boolean সাহসী পরিবেশ

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

Text — বর্তমান উপাদান

অনুমোদন

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

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

set Bold(startOffset, endOffsetInclusive, bold)

নির্দিষ্ট অক্ষর পরিসরের জন্য গাঢ় সেটিং সেট করে।

// Opens the Docs file by its URL. If you created your script from within a
// Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the URL with your own.
const doc = DocumentApp.openByUrl(
    'https://docs.google.com/document/d/DOCUMENT_ID/edit',
);

// Gets the body contents of the tab by its ID.
// TODO(developer): Replace the ID with your own.
const body = doc.getTab('123abc').asDocumentTab().getBody();

// Sets the first 11 characters in the tab's body to bold.
const text = body.editAsText().setBold(0, 10, true);

পরামিতি

নাম আদর্শ বিবরণ
start Offset Integer টেক্সট রেঞ্জের শুরুর অফসেট।
end Offset Inclusive Integer টেক্সট রেঞ্জের শেষ অফসেট।
bold Boolean সাহসী পরিবেশ।

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

Text — বর্তমান উপাদান।

অনুমোদন

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

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

set Font Family(startOffset, endOffsetInclusive, fontFamilyName)

নির্দিষ্ট অক্ষর পরিসরের জন্য ফন্ট পরিবার সেট করে। নামটি ডক্স বা গুগল ফন্টের ফন্ট মেনু থেকে যেকোনো ফন্ট হতে পারে এবং কেস-সংবেদনশীল। অচেনা ফন্টের নামগুলি Arial হিসাবে রেন্ডার করা হবে। পদ্ধতিগুলি get Font Family(offset) এবং set Font Family(fontFamilyName) এখন Font Family enum এর পরিবর্তে ফন্টের জন্য স্ট্রিং নাম ব্যবহার করে। যদিও এই enumটি অবচিত, এটি পুরানো স্ক্রিপ্টগুলির সাথে সামঞ্জস্যের জন্য উপলব্ধ থাকবে।

// Opens the Docs file by its URL. If you created your script from within a
// Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the URL with your own.
const doc = DocumentApp.openByUrl(
    'https://docs.google.com/document/d/DOCUMENT_ID/edit',
);

// Gets the body contents of the tab by its ID.
// TODO(developer): Replace the ID with your own.
const body = doc.getTab('123abc').asDocumentTab().getBody();

// Sets the font of the first 4 characters in the tab's body to Roboto.
const text = body.editAsText().setFontFamily(0, 3, 'Roboto');

পরামিতি

নাম আদর্শ বিবরণ
start Offset Integer টেক্সট রেঞ্জের শুরুর অফসেট।
end Offset Inclusive Integer টেক্সট রেঞ্জের শেষ অফসেট।
font Family Name String ডক্স বা গুগল ফন্টের ফন্ট মেনু থেকে ফন্ট পরিবারের নাম।

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

Text — বর্তমান উপাদান।

অনুমোদন

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

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

set Font Family(fontFamilyName)

ফন্ট ফ্যামিলি সেট করে। নামটি ডক্স বা গুগল ফন্টের ফন্ট মেনু থেকে যেকোনো ফন্ট হতে পারে এবং কেস-সংবেদনশীল। অচেনা ফন্টের নামগুলি Arial হিসাবে রেন্ডার করা হবে। পদ্ধতিগুলি get Font Family() এবং set Font Family(fontFamilyName) এখন Font Family enum এর পরিবর্তে ফন্টের জন্য স্ট্রিং নাম ব্যবহার করে। যদিও এই enumটি অবচিত, এটি পুরানো স্ক্রিপ্টগুলির সাথে সামঞ্জস্যের জন্য উপলব্ধ থাকবে।

পরামিতি

নাম আদর্শ বিবরণ
font Family Name String ডক্স বা গুগল ফন্টের ফন্ট মেনু থেকে ফন্ট পরিবারের নাম

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

Text — বর্তমান উপাদান

অনুমোদন

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

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

set Font Size(startOffset, endOffsetInclusive, size)

নির্দিষ্ট অক্ষর পরিসরের জন্য ফন্টের আকার নির্ধারণ করে।

// Opens the Docs file by its URL. If you created your script from within a
// Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the URL with your own.
const doc = DocumentApp.openByUrl(
    'https://docs.google.com/document/d/DOCUMENT_ID/edit',
);

// Gets the body contents of the tab by its ID.
// TODO(developer): Replace the ID with your own.
const body = doc.getTab('123abc').asDocumentTab().getBody();

// Sets the size of the first 11 characters in the tab's body to 12.
const text = body.editAsText().setFontSize(0, 10, 12);

পরামিতি

নাম আদর্শ বিবরণ
start Offset Integer টেক্সট রেঞ্জের শুরুর অফসেট।
end Offset Inclusive Integer টেক্সট রেঞ্জের শেষ অফসেট।
size Number ফন্টের আকার।

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

Text — বর্তমান উপাদান।

অনুমোদন

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

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

set Font Size(size)

ফন্টের আকার নির্ধারণ করে।

পরামিতি

নাম আদর্শ বিবরণ
size Number ফন্টের আকার

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

Text — বর্তমান উপাদান

অনুমোদন

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

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

set Foreground Color(startOffset, endOffsetInclusive, color)

নির্দিষ্ট অক্ষর পরিসরের জন্য অগ্রভাগের রঙ সেট করে।

// Opens the Docs file by its URL. If you created your script from within a
// Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the URL with your own.
const doc = DocumentApp.openByUrl(
    'https://docs.google.com/document/d/DOCUMENT_ID/edit',
);

// Gets the body contents of the tab by its ID.
// TODO(developer): Replace the ID with your own.
const body = doc.getTab('123abc').asDocumentTab().getBody();

// Sets the foreground color of the first 2 characters in the
// tab's body to hex color #FF0000.
const text = body.editAsText().setForegroundColor(0, 1, '#FF0000');

// Gets the foreground color for the second character in the tab's body.
const foregroundColor = text.getForegroundColor(1);

//  Logs the foreground color to the console.
console.log(foregroundColor);

পরামিতি

নাম আদর্শ বিবরণ
start Offset Integer টেক্সট রেঞ্জের শুরুর অফসেট।
end Offset Inclusive Integer টেক্সট রেঞ্জের শেষ অফসেট।
color String ফোরগ্রাউন্ড রঙ, CSS নোটেশনে ফর্ম্যাট করা (যেমন '#ffffff' )।

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

Text — বর্তমান উপাদান।

অনুমোদন

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

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

set Foreground Color(color)

অগ্রভাগের রঙ সেট করে।

পরামিতি

নাম আদর্শ বিবরণ
color String ফোরগ্রাউন্ড রঙ, CSS নোটেশনে ফরম্যাট করা (যেমন '#ffffff' )

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

Text — বর্তমান উপাদান

অনুমোদন

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

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

set Italic(italic)

ইটালিক সেটিং সেট করে।

পরামিতি

নাম আদর্শ বিবরণ
italic Boolean ইটালিক সেটিং

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

Text — বর্তমান উপাদান

অনুমোদন

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

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

set Italic(startOffset, endOffsetInclusive, italic)

নির্দিষ্ট অক্ষর পরিসরের জন্য ইটালিক সেটিং সেট করে।

// Opens the Docs file by its URL. If you created your script from within a
// Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the URL with your own.
const doc = DocumentApp.openByUrl(
    'https://docs.google.com/document/d/DOCUMENT_ID/edit',
);

// Gets the body contents of the tab by its ID.
// TODO(developer): Replace the ID with your own.
const body = doc.getTab('123abc').asDocumentTab().getBody();

// Sets the first 11 characters in the tab's body to italic.
const text = body.editAsText().setItalic(0, 10, true);

পরামিতি

নাম আদর্শ বিবরণ
start Offset Integer টেক্সট রেঞ্জের শুরুর অফসেট।
end Offset Inclusive Integer টেক্সট রেঞ্জের শেষ অফসেট।
italic Boolean ইটালিক সেটিং।

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

Text — বর্তমান উপাদান।

অনুমোদন

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

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

set Link Url(startOffset, endOffsetInclusive, url)

নির্দিষ্ট অক্ষর পরিসরের জন্য লিঙ্ক URL সেট করে।

// Opens the Docs file by its URL. If you created your script from within a
// Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the URL with your own.
const doc = DocumentApp.openByUrl(
    'https://docs.google.com/document/d/DOCUMENT_ID/edit',
);

// Gets the body contents of the tab by its ID.
// TODO(developer): Replace the ID with your own.
const body = doc.getTab('123abc').asDocumentTab().getBody();

// Applies a link to the first 11 characters in the body.
const text = body.editAsText().setLinkUrl(0, 10, 'https://example.com');

পরামিতি

নাম আদর্শ বিবরণ
start Offset Integer টেক্সট রেঞ্জের শুরুর অফসেট।
end Offset Inclusive Integer টেক্সট রেঞ্জের শেষ অফসেট।
url String লিঙ্কের URL।

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

Text — বর্তমান উপাদান।

অনুমোদন

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

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

set Link Url(url)

লিঙ্কের url সেট করে।

পরামিতি

নাম আদর্শ বিবরণ
url String লিঙ্কের ইউআরএল

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

Text — বর্তমান উপাদান

অনুমোদন

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

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

set Strikethrough(strikethrough)

স্ট্রাইকথ্রু সেটিং সেট করে।

পরামিতি

নাম আদর্শ বিবরণ
strikethrough Boolean স্ট্রাইকথ্রু সেটিং

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

Text — বর্তমান উপাদান

অনুমোদন

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

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

set Strikethrough(startOffset, endOffsetInclusive, strikethrough)

নির্দিষ্ট অক্ষর পরিসরের জন্য স্ট্রাইকথ্রু সেটিং সেট করে।

// Opens the Docs file by its URL. If you created your script from within a
// Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the URL with your own.
const doc = DocumentApp.openByUrl(
    'https://docs.google.com/document/d/DOCUMENT_ID/edit',
);

// Gets the body contents of the tab by its ID.
// TODO(developer): Replace the ID with your own.
const body = doc.getTab('123abc').asDocumentTab().getBody();

// Sets the first 11 characters in the tab's body to strikethrough.
const text = body.editAsText().setStrikethrough(0, 10, true);

পরামিতি

নাম আদর্শ বিবরণ
start Offset Integer টেক্সট রেঞ্জের শুরুর অফসেট।
end Offset Inclusive Integer টেক্সট রেঞ্জের শেষ অফসেট।
strikethrough Boolean স্ট্রাইকথ্রু সেটিং।

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

Text — বর্তমান উপাদান।

অনুমোদন

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

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

set Text(text)

টেক্সটের বিষয়বস্তু সেট করে।

// Opens the Docs file by its URL. If you created your script from within a
// Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the URL with your own.
const doc = DocumentApp.openByUrl(
    'https://docs.google.com/document/d/DOCUMENT_ID/edit',
);

// Gets the body contents of the tab by its ID.
// TODO(developer): Replace the ID with your own.
const body = doc.getTab('123abc').asDocumentTab().getBody();

// Replaces the contents of the body with the text, 'New body text.'
const text = body.editAsText().setText('New body text.');

পরামিতি

নাম আদর্শ বিবরণ
text String নতুন লেখার বিষয়বস্তু।

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

Text — বর্তমান উপাদান।

অনুমোদন

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

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

set Text Alignment(startOffset, endOffsetInclusive, textAlignment)

একটি প্রদত্ত অক্ষর পরিসরের জন্য টেক্সট অ্যালাইনমেন্ট সেট করে। অ্যালাইনমেন্টের উপলব্ধ ধরণগুলি হল Document App.TextAlignment.NORMAL , Document App.TextAlignment.SUBSCRIPT , এবং Document App.TextAlignment.SUPERSCRIPT

// Make the first character in the first paragraph of the active tab be
// superscript.
const documentTab =
    DocumentApp.getActiveDocument().getActiveTab().asDocumentTab();
const text = documentTab.getBody().getParagraphs()[0].editAsText();
text.setTextAlignment(0, 0, DocumentApp.TextAlignment.SUPERSCRIPT);

পরামিতি

নাম আদর্শ বিবরণ
start Offset Integer অক্ষর পরিসরের শুরুর অফসেট।
end Offset Inclusive Integer অক্ষর পরিসরের শেষ অফসেট (সমেত)।
text Alignment Text Alignment প্রয়োগ করার জন্য টেক্সট অ্যালাইনমেন্টের ধরণ।

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

Text — বর্তমান উপাদান।

অনুমোদন

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

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

set Text Alignment(textAlignment)

টেক্সট অ্যালাইনমেন্ট সেট করে। অ্যালাইনমেন্টের উপলব্ধ ধরণগুলি হল Document App.TextAlignment.NORMAL , Document App.TextAlignment.SUBSCRIPT , এবং Document App.TextAlignment.SUPERSCRIPT

// Make the entire first paragraph in the active tab be superscript.
const documentTab =
    DocumentApp.getActiveDocument().getActiveTab().asDocumentTab();
const text = documentTab.getBody().getParagraphs()[0].editAsText();
text.setTextAlignment(DocumentApp.TextAlignment.SUPERSCRIPT);

পরামিতি

নাম আদর্শ বিবরণ
text Alignment Text Alignment প্রয়োগ করার জন্য টেক্সট অ্যালাইনমেন্টের ধরণ

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

Text — বর্তমান উপাদান

অনুমোদন

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

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

set Underline(underline)

আন্ডারলাইন সেটিং সেট করে।

পরামিতি

নাম আদর্শ বিবরণ
underline Boolean আন্ডারলাইন সেটিং

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

Text — বর্তমান উপাদান

অনুমোদন

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

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

set Underline(startOffset, endOffsetInclusive, underline)

নির্দিষ্ট অক্ষর পরিসরের জন্য আন্ডারলাইন সেটিং সেট করে।

// Opens the Docs file by its URL. If you created your script from within a
// Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the URL with your own.
const doc = DocumentApp.openByUrl(
    'https://docs.google.com/document/d/DOCUMENT_ID/edit',
);

// Gets the body contents of the tab by its ID.
// TODO(developer): Replace the ID with your own.
const body = doc.getTab('123abc').asDocumentTab().getBody();

// Sets the first 11 characters in the tab's body to underline.
const text = body.editAsText().setUnderline(0, 10, true);

পরামিতি

নাম আদর্শ বিবরণ
start Offset Integer টেক্সট রেঞ্জের শুরুর অফসেট।
end Offset Inclusive Integer টেক্সট রেঞ্জের শেষ অফসেট।
underline Boolean আন্ডারলাইন সেটিং।

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

Text — বর্তমান উপাদান।

অনুমোদন

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

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