Class Text

পাঠ্য

একটি এলিমেন্ট যা একটি রিচ টেক্সট অঞ্চলকে উপস্থাপন করে। একটি Document সমস্ত টেক্সট Text এলিমেন্টের মধ্যে থাকে। একটি Text এলিমেন্ট একটি Equation , EquationFunction , ListItem বা Paragraph মধ্যে থাকতে পারে, কিন্তু এটি নিজে অন্য কোনো এলিমেন্ট ধারণ করতে পারে না। ডকুমেন্টের গঠন সম্পর্কে আরও তথ্যের জন্য, গুগল ডক্স সম্প্রসারণের নির্দেশিকাটি দেখুন।

// 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 লিঙ্ক ইউআরএলটি পুনরুদ্ধার করে।
get Link Url(offset) String|null নির্দিষ্ট ক্যারেক্টার অফসেটে লিঙ্ক ইউআরএলটি পুনরুদ্ধার করে।
get Next Sibling() Element |null এলিমেন্টটির পরবর্তী সিibling এলিমেন্টটি খুঁজে বের করে।
get Parent() Container Element |null এলিমেন্টটির প্যারেন্ট এলিমেন্ট পুনরুদ্ধার করে।
get Previous Sibling() Element |null এলিমেন্টটির পূর্ববর্তী সিibling এলিমেন্টটি পুনরুদ্ধার করে।
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 নির্দিষ্ট অক্ষর পরিসরের জন্য লিঙ্ক ইউআরএল নির্ধারণ করে।
set Link Url(url) Text লিঙ্ক ইউআরএল নির্ধারণ করে।
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 নির্দিষ্ট অক্ষর পরিসরের জন্য আন্ডারলাইন সেটিং নির্ধারণ করে।

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

appendText(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

deleteText(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

editAsText()

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

এলিমেন্টের বিষয়বস্তুকে রিচ টেক্সট হিসেবে পরিবর্তন করার জন্য editAsText ব্যবহার করুন। editAsText মোড নন-টেক্সট এলিমেন্টগুলোকে (যেমন InlineImage এবং HorizontalRule ) উপেক্ষা করে।

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

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 — বর্তমান এলিমেন্টের একটি টেক্সট সংস্করণ


findText(searchPattern)

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

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

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

প্যারামিটার

নাম প্রকার বর্ণনা
search Pattern String অনুসন্ধান করার জন্য প্যাটার্ন

ফেরত

RangeElement |null — অনুসন্ধানের টেক্সটের অবস্থান নির্দেশকারী একটি ফলাফল, অথবা কোনো মিল না থাকলে null।

অনুমোদন

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

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

findText(searchPattern, from)

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

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

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

প্যারামিটার

নাম প্রকার বর্ণনা
search Pattern String অনুসন্ধান করার জন্য প্যাটার্ন
from Range Element অনুসন্ধানের ফলাফল থেকে অনুসন্ধান করুন

ফেরত

RangeElement |null — অনুসন্ধানের ফলাফল যা অনুসন্ধান করা টেক্সটের পরবর্তী অবস্থান নির্দেশ করে, অথবা কোনো মিল না পাওয়া গেলে null।

অনুমোদন

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

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

getAttributes()

এলিমেন্টটির অ্যাট্রিবিউটগুলো পুনরুদ্ধার করে।

এর ফলে এমন একটি অবজেক্ট তৈরি হয়, যাতে প্রতিটি বৈধ এলিমেন্ট অ্যাট্রিবিউটের জন্য একটি করে প্রপার্টি থাকে এবং প্রতিটি প্রপার্টির নাম DocumentApp.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

getAttributes(offset)

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

এর ফলে এমন একটি অবজেক্ট তৈরি হয়, যাতে প্রতিটি বৈধ টেক্সট অ্যাট্রিবিউটের জন্য একটি করে প্রপার্টি থাকে এবং প্রতিটি প্রপার্টির নাম DocumentApp.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

getBackgroundColor()

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

ফেরত

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

অনুমোদন

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

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

getBackgroundColor(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

getFontFamily()

ফন্ট ফ্যামিলি সেটিং পুনরুদ্ধার করে। নামটি ডক্স বা গুগল ফন্টস- এর ফন্ট মেনু থেকে যেকোনো ফন্ট হতে পারে এবং এটি কেস-সেনসিটিভ। getFontFamily() এবং setFontFamily(fontFamilyName) মেথডগুলো এখন FontFamily enum-এর পরিবর্তে ফন্টের জন্য স্ট্রিং নাম ব্যবহার করে। যদিও এই enum-টি ডেপ্রিকেটেড, পুরোনো স্ক্রিপ্টগুলোর সাথে সামঞ্জস্য রক্ষার জন্য এটি উপলব্ধ থাকবে।

ফেরত

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

অনুমোদন

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

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

getFontFamily(offset)

নির্দিষ্ট ক্যারেক্টার অফসেটে ফন্ট ফ্যামিলিটি খুঁজে বের করে। নামটি ডকস (Docs) বা গুগল ফন্টস (Google Fonts)-এর ফন্ট মেনু থেকে যেকোনো ফন্ট হতে পারে এবং এটি কেস-সেনসিটিভ। getFontFamily() এবং setFontFamily(fontFamilyName) মেথডগুলো এখন FontFamily 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

getFontSize()

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

ফেরত

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

অনুমোদন

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

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

getFontSize(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

getForegroundColor()

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

ফেরত

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

অনুমোদন

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

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

getForegroundColor(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

getLinkUrl()

লিঙ্ক ইউআরএলটি পুনরুদ্ধার করে।

ফেরত

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

অনুমোদন

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

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

getLinkUrl(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();

// 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 — লিঙ্ক ইউআরএল।

অনুমোদন

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

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

getNextSibling()

এলিমেন্টটির পরবর্তী সিibling এলিমেন্টটি খুঁজে বের করে।

পরবর্তী সিবলিং-এর প্যারেন্ট একই থাকে এবং এটি বর্তমান এলিমেন্টটিকে অনুসরণ করে।

ফেরত

Element |null — পরবর্তী সহোদর এলিমেন্ট।

অনুমোদন

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

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

getParent()

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

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

ফেরত

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

অনুমোদন

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

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

getPreviousSibling()

এলিমেন্টটির পূর্ববর্তী সিibling এলিমেন্টটি পুনরুদ্ধার করে।

পূর্ববর্তী সিবলিং-এর প্যারেন্ট একই এবং এটি বর্তমান এলিমেন্টের আগে আসে।

ফেরত

Element |null — পূর্ববর্তী সহোদর এলিমেন্ট।

অনুমোদন

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

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

getText()

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

ফেরত

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

অনুমোদন

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

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

getTextAlignment()

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

ফেরত

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

অনুমোদন

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

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

getTextAlignment(offset)

একটিমাত্র অক্ষরের জন্য টেক্সট অ্যালাইনমেন্ট নির্ধারণ করে। উপলব্ধ অ্যালাইনমেন্টের প্রকারগুলি হলো DocumentApp.TextAlignment.NORMAL , DocumentApp.TextAlignment.SUBSCRIPT এবং DocumentApp.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 অক্ষরটির অফসেট।

ফেরত

TextAlignment |null — টেক্সট অ্যালাইনমেন্টের ধরন, অথবা null যদি টেক্সট অ্যালাইনমেন্ট কখনও সেট করা না হয়ে থাকে।

অনুমোদন

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

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

getTextAttributeIndices()

স্বতন্ত্র টেক্সট ফরম্যাটিং রানের শুরুর সাথে সঙ্গতিপূর্ণ টেক্সট ইনডেক্সগুলোর সেট পুনরুদ্ধার করে।

// 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

getType()

এলিমেন্টটির ElementType পুনরুদ্ধার করে।

কোনো প্রদত্ত এলিমেন্টের সঠিক টাইপ নির্ধারণ করতে getType() ব্যবহার করুন।

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.');
}

ফেরত

ElementType — এলিমেন্টের প্রকার।

অনুমোদন

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

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

insertText(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

isAtDocumentEnd()

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

ফেরত

Boolean — এলিমেন্টটি ট্যাবের শেষে আছে কি না।

অনুমোদন

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

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

isBold()

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

ফেরত

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

অনুমোদন

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

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

isBold(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

isItalic()

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

ফেরত

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

অনুমোদন

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

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

isItalic(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

isStrikethrough()

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

ফেরত

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

অনুমোদন

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

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

isStrikethrough(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

isUnderline()

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

ফেরত

Boolean|null — লেখাটি আন্ডারলাইন করা হবে কিনা, অথবা এলিমেন্টটিতে এই অ্যাট্রিবিউটের জন্য একাধিক মান থাকলে নাল (null) হবে।

অনুমোদন

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

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

isUnderline(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()

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

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

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

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

removeFromParent()

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

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

replaceText(searchPattern, replacement)

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

সার্চ প্যাটার্নটি একটি স্ট্রিং হিসেবে পাস করা হয়, কোনো জাভাস্ক্রিপ্ট রেগুলার এক্সপ্রেশন অবজেক্ট হিসেবে নয়। এই কারণে, প্যাটার্নের মধ্যে থাকা যেকোনো ব্যাকস্ল্যাশকে এস্কেপ করতে হবে।

এই পদ্ধতিতে গুগলের 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

setAttributes(startOffset, endOffsetInclusive, attributes)

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

নির্দিষ্ট অ্যাট্রিবিউটস প্যারামিটারটি অবশ্যই একটি অবজেক্ট হতে হবে, যেখানে প্রতিটি প্রপার্টির নাম হবে DocumentApp.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

setAttributes(attributes)

এলিমেন্টের অ্যাট্রিবিউটগুলো নির্ধারণ করে।

নির্দিষ্ট অ্যাট্রিবিউটস প্যারামিটারটি অবশ্যই একটি অবজেক্ট হতে হবে, যেখানে প্রতিটি প্রপার্টির নাম হবে DocumentApp.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

setBackgroundColor(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

setBackgroundColor(color)

পটভূমির রঙ নির্ধারণ করে।

প্যারামিটার

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

ফেরত

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

অনুমোদন

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

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

setBold(bold)

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

প্যারামিটার

নাম প্রকার বর্ণনা
bold Boolean সাহসী সেটিং

ফেরত

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

অনুমোদন

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

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

setBold(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

setFontFamily(startOffset, endOffsetInclusive, fontFamilyName)

নির্দিষ্ট অক্ষর পরিসরের জন্য ফন্ট ফ্যামিলি নির্ধারণ করে। নামটি ডক্স (Docs) বা গুগল ফন্টস (Google Fonts)-এর ফন্ট মেনু থেকে যেকোনো ফন্ট হতে পারে এবং এটি কেস-সেনসিটিভ। অপরিচিত ফন্টের নাম এরিয়াল (Arial) হিসেবে প্রদর্শিত হবে। getFontFamily(offset) এবং setFontFamily(fontFamilyName) মেথডগুলো এখন FontFamily 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 Docs বা Google Fonts-এর Font মেনু থেকে ফন্ট ফ্যামিলির নামটি।

ফেরত

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

অনুমোদন

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

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

setFontFamily(fontFamilyName)

ফন্ট ফ্যামিলি নির্ধারণ করে। নামটি ডক্স (Docs) বা গুগল ফন্টস (Google Fonts)- এর ফন্ট মেনু থেকে যেকোনো ফন্ট হতে পারে এবং এটি কেস-সেনসিটিভ। অপরিচিত ফন্টের নাম এরিয়াল (Arial) হিসেবে প্রদর্শিত হবে। getFontFamily() এবং setFontFamily(fontFamilyName) মেথডগুলো এখন FontFamily enum-এর পরিবর্তে ফন্টের জন্য স্ট্রিং নাম ব্যবহার করে। যদিও এই enum-টি এখন আর ব্যবহৃত হয় না, পুরোনো স্ক্রিপ্টগুলোর সাথে সামঞ্জস্য রক্ষার জন্য এটি উপলব্ধ থাকবে।

প্যারামিটার

নাম প্রকার বর্ণনা
font Family Name String Docs বা Google Fonts-এর Font মেনু থেকে ফন্ট ফ্যামিলির নামটি।

ফেরত

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

অনুমোদন

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

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

setFontSize(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

setFontSize(size)

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

প্যারামিটার

নাম প্রকার বর্ণনা
size Number ফন্টের আকার

ফেরত

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

অনুমোদন

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

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

setForegroundColor(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

setForegroundColor(color)

ফোরগ্রাউন্ড রঙ নির্ধারণ করে।

প্যারামিটার

নাম প্রকার বর্ণনা
color String ফোরগ্রাউন্ড কালার, যা CSS নোটেশনে ফরম্যাট করা হয় (যেমন '#ffffff' )

ফেরত

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

অনুমোদন

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

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

setItalic(italic)

ইটালিক সেটিং নির্ধারণ করে।

প্যারামিটার

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

ফেরত

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

অনুমোদন

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

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

setItalic(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

setLinkUrl(startOffset, endOffsetInclusive, 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 লিঙ্ক ইউআরএল।

ফেরত

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

অনুমোদন

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

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

setLinkUrl(url)

লিঙ্ক ইউআরএল নির্ধারণ করে।

প্যারামিটার

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

ফেরত

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

অনুমোদন

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

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

setStrikethrough(strikethrough)

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

প্যারামিটার

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

ফেরত

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

অনুমোদন

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

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

setStrikethrough(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

setText(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

setTextAlignment(startOffset, endOffsetInclusive, textAlignment)

একটি নির্দিষ্ট অক্ষর পরিসরের জন্য টেক্সট অ্যালাইনমেন্ট নির্ধারণ করে। উপলব্ধ অ্যালাইনমেন্টের প্রকারগুলি হলো DocumentApp.TextAlignment.NORMAL , DocumentApp.TextAlignment.SUBSCRIPT এবং DocumentApp.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

setTextAlignment(textAlignment)

টেক্সট অ্যালাইনমেন্ট নির্ধারণ করে। উপলব্ধ অ্যালাইনমেন্টের প্রকারগুলি হলো DocumentApp.TextAlignment.NORMAL , DocumentApp.TextAlignment.SUBSCRIPT এবং DocumentApp.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

setUnderline(underline)

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

প্যারামিটার

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

ফেরত

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

অনুমোদন

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

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

setUnderline(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