قواعد وسلوك التعديل الهيكلي
تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
يوضّح هذا القسم السلوكيات والقيود التي يجب فهمها عند تعديل المستندات باستخدام Google Docs API.
بشكل عام، لا يمكنك تنفيذ تعديلات تؤدي إلى بنية غير صالحة للعناصر داخل المستند. راجِع كل طريقة من طرق
documents.batchUpdate
الطلبات لمعرفة القيود والقواعد التي تنطبق على هذه
الطلبات.
تلخّص الأقسام التالية القواعد الأساسية في ما يتعلّق بهذه الطرق.
إدراج نص
- يؤدي إدراج حرف سطر جديد ضمنيًا إلى إنشاء
Paragraph
في
هذا الفهرس. يتم نسخ نمط الفقرة الجديدة من الفقرة في فهرس الإدراج الحالي، بما في ذلك القوائم والنقاط.
- يجب إدراج النص ضمن حدود
Paragraph
حالي. على سبيل المثال، لا يمكن إدراج نص في فهرس بداية الجدول. يجب إدراج النص في الفقرة السابقة.
- قد تعدّل واجهة برمجة التطبيقات الموقع الجغرافي ضمنيًا لمنع عمليات الإدراج داخل مجموعات رسوم Unicode. وعند حدوث ذلك، يتم إدراج النص
مباشرةً بعد مجموعة الوحدات الرسومية.
- يتم تحديد أنماط النص المُدرَج تلقائيًا، مع الحفاظ بشكل عام على نمط النص المجاور. عادةً، يتطابق نمط النص المُدرَج مع النص الذي يسبق مباشرةً فهرس الإدراج.
- تتم إزالة بعض أحرف التحكّم (
U+0000-U+0008, U+000C-U+001F
) والأحرف من
منطقة الاستخدام الخاص في المستوى الأساسي المتعدد اللغات في Unicode (U+E000-U+F8FF
) من النص المُدرَج.
- لمزيد من المعلومات، يُرجى الاطّلاع على إدراج النص وحذفه ونقله.
إدراج صور مضمَّنة
- يجب أن يكون حجم الصورة أقل من 50 ميغابايت، وألا تتجاوز دقتها 25 ميغابكسل، وأن تكون بتنسيق PNG أو JPEG أو GIF.
- يجب أن يكون معرّف الموارد الموحّد المقدَّم متاحًا للجميع وألا يزيد طوله عن 2 كيلوبايت.
- يجب إدراج الصورة ضمن حدود
Paragraph
حالي. على سبيل المثال، لا يمكن إدراج نص في فهرس بداية الجدول.
- لا يمكن إدراج الصور داخل حاشية سفلية أو معادلة.
- لمزيد من المعلومات، يُرجى الاطّلاع على إدراج صور مضمّنة.
تنسيق النص
- عند تطبيق تنسيق على مستوى الفقرة على نطاق معيّن، يتم تطبيق التنسيق على أي فقرة يتداخل معها هذا النطاق جزئيًا أو كليًا.
- قد يتم توسيع النطاق ليشمل أسطرًا جديدة مجاورة.
- إذا كان النطاق يتضمّن فقرة تنتمي إلى قائمة، سيتم أيضًا تعديل نقطة التعداد الخاصة بالفقرة باستخدام نمط النص المطابق.
- لمزيد من المعلومات، اطّلِع على تنسيق النص.
إنشاء رموز نقطية للفقرات
- تنشئ هذه الطريقة رموزًا نقطية لجميع الفقرات التي تتداخل مع النطاق المحدّد.
- يتم تحديد مستوى التداخل لكل فقرة من خلال عدد علامات التبويب البادئة قبل كل فقرة.
- تتم إزالة علامات التبويب البادئة عند إنشاء النقاط، ما قد يؤدي إلى تغيير فهارس أجزاء النص.
- إذا أضفت نقاط تعداد للفقرات تتطابق مع نقاط التعداد الخاصة بقائمة تسبق الفقرة المستهدفة مباشرةً، سيتم ضم الفقرة إلى القائمة.
- لمزيد من المعلومات، يُرجى الاطّلاع على العمل باستخدام القوائم.
حذف النص
قد يؤدي حذف نص يتجاوز حدود الفقرة إلى حدوث تغييرات في أنماط الفقرات والقوائم والكائنات الموضّعة والإشارات المرجعية، وذلك لأنّه يتم دمج الفقرتين.
لا يُسمح بعمليات الحذف التي تؤدي إلى بنية مستند غير صالحة. في ما يلي بعض الأمثلة على طلبات الحذف غير الصالحة:
لمزيد من المعلومات، يُرجى الاطّلاع على إدراج النص وحذفه ونقله.
إنّ محتوى هذه الصفحة مرخّص بموجب ترخيص Creative Commons Attribution 4.0 ما لم يُنصّ على خلاف ذلك، ونماذج الرموز مرخّصة بموجب ترخيص Apache 2.0. للاطّلاع على التفاصيل، يُرجى مراجعة سياسات موقع Google Developers. إنّ Java هي علامة تجارية مسجَّلة لشركة Oracle و/أو شركائها التابعين.
تاريخ التعديل الأخير: 2025-08-29 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-08-29 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],null,["# Structural edit rules and behavior\n\nThis section describes behaviors and limitations that you must understand when\nyou edit documents using the Google Docs API.\n\nIn general, you cannot execute edits that cause the invalid structure of\nelements within a document. Review each\n[`documents.batchUpdate`](/workspace/docs/api/reference/rest/v1/documents/batchUpdate)\nrequest method for constraints and rules that apply to those\n[requests](/workspace/docs/api/reference/rest/v1/documents/request).\n\nThe following sections summarize the key rules across these methods.\n\nInsert text\n-----------\n\n- Inserting a newline character implicitly creates a [`Paragraph`](/workspace/docs/api/reference/rest/v1/documents#paragraph) at that index. The paragraph style of the new paragraph is copied from the paragraph at the current insertion index, including lists and bullets.\n- Text must be inserted within the bounds of an existing `Paragraph`. For example, text cannot be inserted at a table's start index. The text must be inserted in the preceding paragraph.\n- The API may implicitly adjust the location to prevent insertions within Unicode grapheme clusters. When this happens, the text is inserted immediately after the grapheme cluster.\n- Text styles for inserted text are determined automatically, generally preserving the styling of neighboring text. Typically, the text style for the inserted text matches the text immediately before the insertion index.\n- Some control characters (`U+0000-U+0008, U+000C-U+001F`) and characters from the Unicode Basic Multilingual Plane Private Use Area (`U+E000-U+F8FF`) are stripped out of inserted text.\n- For more information, see [Insert, delete, and move\n text](/workspace/docs/api/how-tos/move-text).\n\nInsert inline images\n--------------------\n\n- Image must be less than 50 MB in size, cannot exceed 25 megapixels, and must be in one of PNG, JPEG, or GIF formats.\n- The provided URI must be publicly accessible and at most 2 KB in length.\n- Image must be inserted within the bounds of an existing `Paragraph`. For example, text cannot be inserted at a table's start index.\n- Images can't be inserted inside a footnote or equation.\n- For more information, see [Insert inline\n images](/workspace/docs/api/how-tos/images).\n\nFormat text\n-----------\n\n- When you apply paragraph-level formatting to a range, the formatting is applied to any paragraph that's partially or completely overlapped by that range.\n- The range might be extended to include adjacent newlines.\n- If the range fully contains a paragraph belonging to a list, the paragraph's bullet is also updated with the matching text style.\n- For more information, see [Format\n text](/workspace/docs/api/how-tos/format-text).\n\nCreate paragraph bullets\n------------------------\n\n- Creates bullets for all paragraphs that overlap with the given range.\n- The nesting level of each paragraph is determined by the number of leading tabs before each paragraph.\n- The leading tabs are removed when creating the bullets, which might change the indexes of parts of the text.\n- If you add paragraph bullets that match those of a list immediately before the target paragraph, the paragraph is joined to the list.\n- For more information, see [Work with lists](/workspace/docs/api/how-tos/lists).\n\nDelete text\n-----------\n\n- Deleting text that crosses a paragraph boundary might cause changes to\n paragraph styles, lists, positioned objects, and bookmarks as the two\n paragraphs are merged.\n\n- Deletions that cause an invalid document structure are not permitted. Some\n examples of invalid delete requests include:\n\n - Deleting one code unit of a surrogate pair.\n\n - Deleting the last newline character of a\n [`Body`](/workspace/docs/api/reference/rest/v1/documents#body),\n [`Header`](/workspace/docs/api/reference/rest/v1/documents#header),\n [`Footer`](/workspace/docs/api/reference/rest/v1/documents#footer),\n [`Footnote`](/workspace/docs/api/reference/rest/v1/documents#footnote),\n [`TableCell`](/workspace/docs/api/reference/rest/v1/documents#tablecell), or\n [`TableOfContents`](/workspace/docs/api/reference/rest/v1/documents#tableofcontents).\n\n - Deleting the start or end of a\n [`Table`](/workspace/docs/api/reference/rest/v1/documents#table),\n `TableOfContents`, or\n [`Equation`](/workspace/docs/api/reference/rest/v1/documents#equation)\n without deleting the entire element.\n\n - Deleting the newline character before a `Table`, `TableOfContents`, or\n [`SectionBreak`](/workspace/docs/api/reference/rest/v1/documents#sectionbreak)\n without deleting the element.\n\n - Deleting individual rows or cells of a table. Deleting the content in a\n table cell is allowed.\n\n- For more information, see [Insert, delete, and move\n text](/workspace/docs/api/how-tos/move-text).\n\nRelated topics\n--------------\n\n- [Structure of a Google Docs document](/workspace/docs/api/concepts/structure)\n- [Requests and responses](/workspace/docs/api/concepts/request-response)"]]