Class Table

টেবিল

একটি টেবিলকে প্রতিনিধিত্বকারী একটি এলিমেন্ট। একটি Table শুধুমাত্র TableRow এলিমেন্ট থাকতে পারে। ডকুমেন্টের গঠন সম্পর্কে আরও তথ্যের জন্য, গুগল ডক্স সম্প্রসারণের নির্দেশিকাটি দেখুন।

প্রচুর সংখ্যক সারি বা সেল সম্বলিত একটি Table তৈরি করার সময়, নিম্নলিখিত উদাহরণে দেখানো অনুযায়ী এটিকে একটি স্ট্রিং অ্যারে থেকে তৈরি করার কথা বিবেচনা করুন।

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

// Create a two-dimensional array containing the 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.
body.appendTable(cells);

পদ্ধতি

পদ্ধতি রিটার্ন টাইপ সংক্ষিপ্ত বিবরণ
append Table Row() Table Row একটি নতুন Table Row তৈরি করে এবং তাতে ডেটা যুক্ত করে।
append Table Row(tableRow) Table Row প্রদত্ত Table Row যুক্ত করে।
clear() Table এলিমেন্টটির বিষয়বস্তু মুছে দেয়।
copy() Table বর্তমান এলিমেন্টটির একটি ডিটাচড, ডিপ কপি ফেরত দেয়।
edit As Text() Text সম্পাদনার জন্য বর্তমান এলিমেন্টটির একটি Text সংস্করণ পাওয়া যায়।
find Element(elementType) Range Element |null এলিমেন্টের বিষয়বস্তুর মধ্যে নির্দিষ্ট টাইপের কোনো বংশধরকে অনুসন্ধান করে।
find Element(elementType, from) Range Element |null নির্দিষ্ট Range Element থেকে শুরু করে, এলিমেন্টটির বিষয়বস্তুর মধ্যে নির্দিষ্ট টাইপের কোনো বংশধরকে অনুসন্ধান করে।
find Text(searchPattern) Range Element |null রেগুলার এক্সপ্রেশন ব্যবহার করে এলিমেন্টের বিষয়বস্তুর মধ্যে নির্দিষ্ট টেক্সট প্যাটার্নটি অনুসন্ধান করে।
find Text(searchPattern, from) Range Element |null প্রদত্ত অনুসন্ধান ফলাফল থেকে শুরু করে, এলিমেন্টের বিষয়বস্তুর মধ্যে নির্দিষ্ট টেক্সট প্যাটার্নটি অনুসন্ধান করে।
get Attributes() Object এলিমেন্টটির অ্যাট্রিবিউটগুলো পুনরুদ্ধার করে।
get Border Color() String|null বর্ডারের রঙ পুনরুদ্ধার করে।
get Border Width() Number|null বর্ডারের প্রস্থ পয়েন্টে প্রকাশ করে।
get Cell(rowIndex, cellIndex) Table Cell |null নির্দিষ্ট সারি এবং সেল সূচকে Table Cell পুনরুদ্ধার করে।
get Child(childIndex) Element নির্দিষ্ট চাইল্ড ইনডেক্সে অবস্থিত চাইল্ড এলিমেন্টটি পুনরুদ্ধার করে।
get Child Index(child) Integer নির্দিষ্ট চাইল্ড এলিমেন্টের চাইল্ড ইনডেক্স পুনরুদ্ধার করে।
get Column Width(columnIndex) Number|null নির্দিষ্ট টেবিল কলামের প্রস্থ পয়েন্টে প্রকাশ করে।
get Link Url() String|null লিঙ্ক ইউআরএলটি পুনরুদ্ধার করে।
get Next Sibling() Element |null এলিমেন্টটির পরবর্তী সিibling এলিমেন্টটি খুঁজে বের করে।
get Num Children() Integer শিশুদের সংখ্যা পুনরুদ্ধার করে।
get Num Rows() Integer Table Rows সংখ্যা পুনরুদ্ধার করে।
get Parent() Container Element |null এলিমেন্টটির প্যারেন্ট এলিমেন্ট পুনরুদ্ধার করে।
get Previous Sibling() Element |null এলিমেন্টটির পূর্ববর্তী সিibling এলিমেন্টটি পুনরুদ্ধার করে।
get Row(rowIndex) Table Row |null নির্দিষ্ট সারি সূচকে Table Row পুনরুদ্ধার করে।
get Text() String এলিমেন্টের বিষয়বস্তু একটি টেক্সট স্ট্রিং হিসেবে পুনরুদ্ধার করে।
get Text Alignment() Text Alignment |null টেক্সটের অ্যালাইনমেন্ট ঠিক করে।
get Type() Element Type এলিমেন্টটির Element Type পুনরুদ্ধার করে।
insert Table Row(childIndex) Table Row নির্দিষ্ট ইনডেক্সে একটি নতুন Table Row তৈরি করে এবং সন্নিবেশ করে।
insert Table Row(childIndex, tableRow) Table Row প্রদত্ত Table Row নির্দিষ্ট ইন্ডেক্সে সন্নিবেশ করে।
is At Document End() Boolean উপাদানটি Document শেষে আছে কিনা তা নির্ধারণ করে।
remove Child(child) Table নির্দিষ্ট চাইল্ড এলিমেন্টটি মুছে ফেলে।
remove From Parent() Table |null এলিমেন্টটিকে তার প্যারেন্ট থেকে সরিয়ে দেয়।
remove Row(rowIndex) Table Row নির্দিষ্ট সারি সূচকে অবস্থিত Table Row মুছে ফেলে।
replace Text(searchPattern, replacement) Element রেগুলার এক্সপ্রেশন ব্যবহার করে, একটি প্রদত্ত টেক্সট প্যাটার্নের সমস্ত উপস্থিতিকে একটি প্রদত্ত রিপ্লেসমেন্ট স্ট্রিং দ্বারা প্রতিস্থাপন করে।
set Attributes(attributes) Table এলিমেন্টের অ্যাট্রিবিউটগুলো নির্ধারণ করে।
set Border Color(color) Table বর্ডারের রঙ নির্ধারণ করে।
set Border Width(width) Table বর্ডারের প্রস্থ পয়েন্টে নির্ধারণ করে।
set Column Width(columnIndex, width) Table নির্দিষ্ট কলামের প্রস্থ পয়েন্টে নির্ধারণ করে।
set Link Url(url) Table লিঙ্ক ইউআরএল নির্ধারণ করে।
set Text Alignment(textAlignment) Table টেক্সটের অ্যালাইনমেন্ট নির্ধারণ করে।

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

appendTableRow()

একটি নতুন TableRow তৈরি করে এবং তাতে ডেটা যুক্ত করে।

ফেরত

TableRow — নতুন টেবিল সারি উপাদান

অনুমোদন

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

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

appendTableRow(tableRow)

প্রদত্ত TableRow যুক্ত করে।

// Opens the Docs file by its ID. If you created your script from within a
// Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the ID with your own.
const doc = DocumentApp.openById('123abc');

// 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 first table in the tab and copies the second row.
const table = body.getTables()[0];
const row = table.getChild(1).copy();

// Adds the copied row to the bottom of the table.
const tableRow = table.appendTableRow(row);

প্যারামিটার

নাম প্রকার বর্ণনা
table Row Table Row যে টেবিলের সারিটি যুক্ত করতে হবে।

ফেরত

TableRow — সংযুক্ত টেবিলের সারি উপাদান।

অনুমোদন

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

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

clear()

এলিমেন্টটির বিষয়বস্তু মুছে দেয়।

ফেরত

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


copy()

বর্তমান এলিমেন্টটির একটি ডিটাচড, ডিপ কপি ফেরত দেয়।

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

ফেরত

Table — নতুন অনুলিপি।

অনুমোদন

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

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


findElement(elementType)

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

প্যারামিটার

নাম প্রকার বর্ণনা
element Type Element Type যে ধরনের উপাদান অনুসন্ধান করতে হবে।

ফেরত

RangeElement |null — একটি অনুসন্ধানের ফলাফল যা অনুসন্ধান উপাদানের অবস্থান নির্দেশ করে।

অনুমোদন

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

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

findElement(elementType, from)

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

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

// Define the search parameters.

let searchResult = null;

// Search until the paragraph is found.
while (
    (searchResult = body.findElement(
         DocumentApp.ElementType.PARAGRAPH,
         searchResult,
         ))) {
  const par = searchResult.getElement().asParagraph();
  if (par.getHeading() === DocumentApp.ParagraphHeading.HEADING1) {
    // Found one, update and stop.
    par.setText('This is the first header.');
    break;
  }
}

প্যারামিটার

নাম প্রকার বর্ণনা
element Type Element Type যে ধরনের উপাদান অনুসন্ধান করতে হবে।
from Range Element অনুসন্ধান করার জন্য অনুসন্ধানের ফলাফল।

ফেরত

RangeElement |null — একটি অনুসন্ধানের ফলাফল যা অনুসন্ধান উপাদানটির পরবর্তী অবস্থান নির্দেশ করে।

অনুমোদন

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

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

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

getBorderColor()

বর্ডারের রঙ পুনরুদ্ধার করে।

// Opens the Docs file by its ID. If you created your script from within a
// Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the ID with your own.
const doc = DocumentApp.openById('123abc');

// 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 first table.
const table = body.getTables()[0];

// Sets the border color of the first table.
table.setBorderColor('#00FF00');

// Logs the border color of the first table to the console.
console.log(table.getBorderColor());

ফেরত

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

অনুমোদন

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

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

getBorderWidth()

বর্ডারের প্রস্থ পয়েন্টে প্রকাশ করে।

// Opens the Docs file by its ID. If you created your script from within a
// Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the ID with your own.
const doc = DocumentApp.openById('123abc');

// 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 first table.
const table = body.getTables()[0];

// Sets the border width of the first table.
table.setBorderWidth(20);

// Logs the border width of the first table.
console.log(table.getBorderWidth());

ফেরত

Number|null — বর্ডারের প্রস্থ, পয়েন্টে।

অনুমোদন

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

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

getCell(rowIndex, cellIndex)

নির্দিষ্ট সারি এবং সেল সূচকে TableCell পুনরুদ্ধার করে।

// Opens the Docs file by its ID. If you created your script from within a
// Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the ID with your own.
const doc = DocumentApp.openById('123abc');

// 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 first table.
const table = body.getTables()[0];

// Gets the cell of the table's third row and second column.
const cell = table.getCell(2, 1);

// Logs the cell text to the console.
console.log(cell.getText());

প্যারামিটার

নাম প্রকার বর্ণনা
row Index Integer যে সেলটি পুনরুদ্ধার করতে হবে, সেই সেলটি ধারণকারী সারির সূচক।
cell Index Integer যে সেলটি পুনরুদ্ধার করতে হবে তার সূচক।

ফেরত

TableCell |null — টেবিলের সেল।

অনুমোদন

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

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

getChild(childIndex)

নির্দিষ্ট চাইল্ড ইনডেক্সে অবস্থিত চাইল্ড এলিমেন্টটি পুনরুদ্ধার করে।

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

// Obtain the first element in the tab.
const firstChild = body.getChild(0);

// If it's a paragraph, set its contents.
if (firstChild.getType() === DocumentApp.ElementType.PARAGRAPH) {
  firstChild.asParagraph().setText('This is the first paragraph.');
}

প্যারামিটার

নাম প্রকার বর্ণনা
child Index Integer যে চাইল্ড এলিমেন্টটি পুনরুদ্ধার করতে হবে তার ইন্ডেক্স।

ফেরত

Element — নির্দিষ্ট ইন্ডেক্সে অবস্থিত চাইল্ড এলিমেন্ট।

অনুমোদন

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

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

getChildIndex(child)

নির্দিষ্ট চাইল্ড এলিমেন্টের চাইল্ড ইনডেক্স পুনরুদ্ধার করে।

প্যারামিটার

নাম প্রকার বর্ণনা
child Element যে চাইল্ড এলিমেন্টটির ইনডেক্স পুনরুদ্ধার করতে হবে।

ফেরত

Integer — চাইল্ড ইনডেক্স।

অনুমোদন

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

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

getColumnWidth(columnIndex)

নির্দিষ্ট টেবিল কলামের প্রস্থ পয়েন্টে প্রকাশ করে।

// Opens the Docs file by its ID. If you created your script from within a
// Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the ID with your own.
const doc = DocumentApp.openById('123abc');

// 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 first table.
const table = body.getTables()[0];

// Sets the width of the second column to 100 points.
const columnWidth = table.setColumnWidth(1, 100);

// Gets the width of the second column and logs it to the console.
console.log(columnWidth.getColumnWidth(1));

প্যারামিটার

নাম প্রকার বর্ণনা
column Index Integer কলাম সূচক।

ফেরত

Number|null — কলামের প্রস্থ, পয়েন্টে।

অনুমোদন

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

  • 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

getNextSibling()

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

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

ফেরত

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

অনুমোদন

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

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

getNumChildren()

শিশুদের সংখ্যা পুনরুদ্ধার করে।

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

// Log the number of elements in the tab.
Logger.log(`There are ${body.getNumChildren()} elements in the tab's body.`);

ফেরত

Integer — সন্তানের সংখ্যা।

অনুমোদন

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

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

getNumRows()

TableRows সংখ্যা পুনরুদ্ধার করে।

// Opens the Docs file by its ID. If you created your script from within a
// Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the ID with your own.
const doc = DocumentApp.openById('123abc');

// 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 first table.
const table = body.getTables()[0];

// Logs the number of rows of the first table to the console.
console.log(table.getNumRows());

ফেরত

Integer — টেবিলের সারির সংখ্যা।

অনুমোদন

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

  • 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

getRow(rowIndex)

নির্দিষ্ট সারি সূচকে TableRow পুনরুদ্ধার করে।

// Opens the Docs file by its ID. If you created your script from within a
// Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the ID with your own.
const doc = DocumentApp.openById('123abc');

// 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 first table and logs the text of first row to the console.
const table = body.getTables()[0];
console.log(table.getRow(0).getText());

প্যারামিটার

নাম প্রকার বর্ণনা
row Index Integer যে সারিটি পুনরুদ্ধার করতে হবে তার সূচক।

ফেরত

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

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

insertTableRow(childIndex)

নির্দিষ্ট ইনডেক্সে একটি নতুন TableRow তৈরি করে এবং সন্নিবেশ করে।

প্যারামিটার

নাম প্রকার বর্ণনা
child Index Integer যে সূচকে উপাদানটি সন্নিবেশ করতে হবে

ফেরত

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

অনুমোদন

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

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

insertTableRow(childIndex, tableRow)

প্রদত্ত TableRow নির্দিষ্ট ইন্ডেক্সে সন্নিবেশ করে।

প্যারামিটার

নাম প্রকার বর্ণনা
child Index Integer যে সূচকে উপাদানটি সন্নিবেশ করতে হবে
table Row Table Row টেবিলের সারিটি ঢোকানোর জন্য

ফেরত

TableRow — সন্নিবেশিত টেবিলের সারি উপাদান

অনুমোদন

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

  • 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

removeChild(child)

নির্দিষ্ট চাইল্ড এলিমেন্টটি মুছে ফেলে।

// Opens the Docs file by its ID. If you created your script from within a
// Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the ID with your own.
const doc = DocumentApp.openById('123abc');

// 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 first table.
const table = body.getTables()[0];

// Finds the first table row and removes it.
const element = table.findElement(DocumentApp.ElementType.TABLE_ROW);
table.removeChild(element.getElement());

প্যারামিটার

নাম প্রকার বর্ণনা
child Element যে চাইল্ড এলিমেন্টটি অপসারণ করতে হবে।

ফেরত

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

অনুমোদন

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

  • 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();
}

ফেরত

Table |null — অপসারিত উপাদান।

অনুমোদন

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

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

removeRow(rowIndex)

নির্দিষ্ট সারি সূচকে অবস্থিত TableRow মুছে ফেলে।

// Opens the Docs file by its ID. If you created your script from within a
// Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the ID with your own.
const doc = DocumentApp.openById('123abc');

// 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 first table and removes its second row.
const table = body.getTables()[0];
table.removeRow(1);

প্যারামিটার

নাম প্রকার বর্ণনা
row Index Integer যে সারিটি অপসারণ করতে হবে তার সূচক।

ফেরত

TableRow — অপসারিত সারি।

অনুমোদন

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

  • 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(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 এলিমেন্টটির অ্যাট্রিবিউটসমূহ।

ফেরত

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

অনুমোদন

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

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

setBorderColor(color)

বর্ডারের রঙ নির্ধারণ করে।

// Opens the Docs file by its ID. If you created your script from within a
// Google Docs file, you can use DocumentApp.getActiveDocument() instead.
// TODO(developer): Replace the ID with your own.
const doc = DocumentApp.openById('123abc');

// 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 first table.
const table = body.getTables()[0];

// Sets the border color of the table to green.
table.setBorderColor('#00FF00');

প্যারামিটার

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

ফেরত

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

অনুমোদন

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

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

setBorderWidth(width)

বর্ডারের প্রস্থ পয়েন্টে নির্ধারণ করে।

প্যারামিটার

নাম প্রকার বর্ণনা
width Number বর্ডারের প্রস্থ, পয়েন্টে

ফেরত

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

অনুমোদন

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

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

setColumnWidth(columnIndex, width)

নির্দিষ্ট কলামের প্রস্থ পয়েন্টে নির্ধারণ করে।

প্যারামিটার

নাম প্রকার বর্ণনা
column Index Integer কলাম সূচক
width Number বর্ডারের প্রস্থ, পয়েন্টে

ফেরত

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

অনুমোদন

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

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

setLinkUrl(url)

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

প্যারামিটার

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

ফেরত

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

অনুমোদন

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

  • 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 প্রয়োগ করার জন্য টেক্সট অ্যালাইনমেন্টের ধরণ

ফেরত

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

অনুমোদন

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

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