Class EquationSymbol

معادلةرمز

تمثّل هذه السمة رمزًا في Equation رياضية. لا يمكن أن يحتوي EquationSymbol على أي عنصر آخر. لمزيد من المعلومات حول بنية المستند، يُرجى الاطّلاع على دليل توسيع "مستندات Google".

الطُرق

الطريقةنوع القيمة التي يتم إرجاعهاوصف قصير
copy()EquationSymbolتعرض نسخة منفصلة وعميقة من العنصر الحالي.
getAttributes()Objectيستردّ سمات العنصر.
getCode()Stringيستردّ هذا الإجراء الرمز المقابل لرمز المعادلة.
getNextSibling()Element|nullيستردّ العنصر الشقيق التالي للعنصر.
getParent()ContainerElement|nullتعرض هذه السمة العنصر الرئيسي للعنصر الحالي.
getPreviousSibling()Element|nullيستردّ هذا الإجراء العنصر الشقيق السابق للعنصر.
getType()ElementTypeيستردّ ElementType العنصر.
isAtDocumentEnd()Booleanتحدّد هذه السمة ما إذا كان العنصر في نهاية Document.
merge()EquationSymbol|nullيدمج العنصر مع العنصر الشقيق السابق من النوع نفسه.
removeFromParent()EquationSymbol|nullيزيل العنصر من العنصر الأصل.
setAttributes(attributes)EquationSymbolتضبط هذه السمة سمات العنصر.

مستندات تفصيلية

copy()

تعرض نسخة منفصلة وعميقة من العنصر الحالي.

يتم أيضًا نسخ أي عناصر فرعية مضمّنة في العنصر. لا يحتوي العنصر الجديد على عنصر رئيسي.

الإرجاع

EquationSymbol: النسخة الجديدة

التفويض

تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:

  • 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

getCode()

يستردّ هذا الإجراء الرمز المقابل لرمز المعادلة.

الإرجاع

String: رمز العملة

التفويض

تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:

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

getNextSibling()

يستردّ العنصر الشقيق التالي للعنصر.

العنصر الشقيق التالي له العنصر الرئيسي نفسه ويتبع العنصر الحالي.

الإرجاع

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

يستردّ هذا الإجراء العنصر الشقيق السابق للعنصر.

العنصر الشقيق السابق له العنصر الرئيسي نفسه ويسبق العنصر الحالي.

الإرجاع

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

isAtDocumentEnd()

تحدّد هذه السمة ما إذا كان العنصر في نهاية Document.

الإرجاع

Boolean: ما إذا كان العنصر في نهاية علامة التبويب.

التفويض

تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:

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

merge()

يدمج العنصر مع العنصر الشقيق السابق من النوع نفسه.

يمكن دمج عناصر من ElementType نفسه فقط. يتم نقل أي عناصر فرعية مضمّنة في العنصر الحالي إلى العنصر الشقيق السابق.

تتم إزالة العنصر الحالي من المستند.

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

الإرجاع

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

الإرجاع

EquationSymbol|null: العنصر الذي تمت إزالته

التفويض

تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:

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

المعلمات

الاسمالنوعالوصف
attributesObjectسمات العنصر

الإرجاع

EquationSymbol: العنصر الحالي

التفويض

تتطلّب النصوص البرمجية التي تستخدم هذه الطريقة الحصول على إذن باستخدام نطاق واحد أو أكثر من النطاقات التالية:

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