تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
توضّح هذه الصفحة كيفية إضافة شرائح إلى عرض تقديمي حالي في "العروض التقديمية من Google".
شرائح
كل صفحة فردية من عرض تقديمي في "العروض التقديمية من Google" هي شريحة.
لإضافة شريحة إلى العرض التقديمي، تحتاج إلى معرّف العرض التقديمي. يمكنك العثور على
رقم تعريف العرض التقديمي من خلال فتح العرض التقديمي في "العروض التقديمية من Google" ومحاولة
الاطّلاع على عنوان URL الخاص به:
لإضافة شريحة، استخدِم batchUpdate() مع معرّف العرض التقديمي وأدرِج CreateSlideRequest في نص الطلب. يتم عرض رقم تعريف الشريحة الجديدة في نص الاستجابة.
مثال
يوضّح المثال التالي كيفية إضافة شريحة إلى عرض تقديمي. جميع الحقول
لأجل
CreateSlideRequest
هي اختيارية. ينشئ هذا المثال الشريحة كشريحة ثانية، بتنسيق
TITLE_AND_TWO_COLUMNS ومعرّف كائن صريح.
/** * Creates a slide * @param {string} presentationId * @param {string} pageId * @returns {*} */functioncreateSlide(presentationId,pageId){// See Presentation.insertSlide(...) to learn how to add a slide using SlidesApp.// http://developers.google.com/apps-script/reference/slides/presentation#appendslidelayoutconstrequests=[{createSlide:{objectId:pageId,insertionIndex:'1',slideLayoutReference:{predefinedLayout:'TITLE_AND_TWO_COLUMNS'}}}];// If you wish to populate the slide with elements, add element create requests here,// using the pageId.// Execute the request.try{constcreateSlideResponse=Slides.Presentations.batchUpdate({requests:requests},presentationId);console.log('CreatedslidewithID:%s',createSlideResponse.replies[0].createSlide.objectId);returncreateSlideResponse;}catch(err){// TODO (Developer) - Handle exceptionconsole.log('Failedwitherror:%s',err.error);}};
// Add a slide at index 1 using the predefined "TITLE_AND_TWO_COLUMNS" layout// and the ID "MyNewSlide_001".slideId:="MyNewSlide_001"requests:=[]*slides.Request{{
CreateSlide: &slides.CreateSlideRequest{
ObjectId: slideId,
InsertionIndex: 1,
SlideLayoutReference: &slides.LayoutReference{
PredefinedLayout: "TITLE_AND_TWO_COLUMNS",
},
},
}}// If you wish to populate the slide with elements, add create requests here,// using the slide ID specified above.// Execute the request.body:=&slides.BatchUpdatePresentationRequest{Requests:requests,}response,err:=slidesService.Presentations.BatchUpdate(presentationId,body).Do()iferr!=nil{log.Fatalf("Unable to create slide. %v",err)}fmt.Printf("Created slide with ID: %s",response.Replies[0].CreateSlide.ObjectId)
importcom.google.api.client.googleapis.json.GoogleJsonResponseException;importcom.google.api.client.googleapis.json.GoogleJsonError;importcom.google.api.client.http.HttpRequestInitializer;importcom.google.api.client.http.javanet.NetHttpTransport;importcom.google.api.client.json.gson.GsonFactory;importcom.google.api.services.slides.v1.Slides;importcom.google.api.services.slides.v1.SlidesScopes;importcom.google.api.services.slides.v1.model.BatchUpdatePresentationRequest;importcom.google.api.services.slides.v1.model.BatchUpdatePresentationResponse;importcom.google.api.services.slides.v1.model.CreateSlideRequest;importcom.google.api.services.slides.v1.model.CreateSlideResponse;importcom.google.api.services.slides.v1.model.LayoutReference;importcom.google.api.services.slides.v1.model.Request;importcom.google.auth.http.HttpCredentialsAdapter;importcom.google.auth.oauth2.GoogleCredentials;importjava.io.IOException;importjava.util.ArrayList;importjava.util.Collections;importjava.util.List;/* Class to demonstrate the use of Create Slides API */publicclassCreateSlide{/** * Creates a new slide. * * @param presentationId - id of the presentation. * @return slide id * @throws IOException - if credentials file not found. */publicstaticBatchUpdatePresentationResponsecreateSlide(StringpresentationId)throwsIOException{/* Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for your application. */GoogleCredentialscredentials=GoogleCredentials.getApplicationDefault().createScoped(Collections.singleton(SlidesScopes.PRESENTATIONS));HttpRequestInitializerrequestInitializer=newHttpCredentialsAdapter(credentials);// Create the slides API clientSlidesservice=newSlides.Builder(newNetHttpTransport(),GsonFactory.getDefaultInstance(),requestInitializer).setApplicationName("Slides samples").build();// Add a slide at index 1 using the predefined "TITLE_AND_TWO_COLUMNS" layoutList<Request>requests=newArrayList<>();StringslideId="MyNewSlide_001";BatchUpdatePresentationResponseresponse=null;try{requests.add(newRequest().setCreateSlide(newCreateSlideRequest().setObjectId(slideId).setInsertionIndex(1).setSlideLayoutReference(newLayoutReference().setPredefinedLayout("TITLE_AND_TWO_COLUMNS"))));// If you wish to populate the slide with elements, add create requests here,// using the slide ID specified above.// Execute the request.BatchUpdatePresentationRequestbody=newBatchUpdatePresentationRequest().setRequests(requests);response=service.presentations().batchUpdate(presentationId,body).execute();CreateSlideResponsecreateSlideResponse=response.getReplies().get(0).getCreateSlide();// Prints the slide id.System.out.println("Created slide with ID: "+createSlideResponse.getObjectId());}catch(GoogleJsonResponseExceptione){// TODO(developer) - handle error appropriatelyGoogleJsonErrorerror=e.getDetails();if(error.getCode()==400){System.out.printf(" Id '%s' should be unique among all pages and page elements.\n",presentationId);}elseif(error.getCode()==404){System.out.printf("Presentation not found with id '%s'.\n",presentationId);}else{throwe;}}returnresponse;}}
functioncreateSlide(presentationId,pageId,callback){constrequests=[{createSlide:{objectId:pageId,insertionIndex:'1',slideLayoutReference:{predefinedLayout:'TITLE_AND_TWO_COLUMNS',},},},];// If you wish to populate the slide with elements, add element create requests here,// using the pageId.// Execute the request.try{gapi.client.slides.presentations.batchUpdate({presentationId:presentationId,requests:requests,}).then((createSlideResponse)=>{constobjectId=createSlideResponse.result.replies[0].createSlide.objectId;console.log(`Created slide with ID: ${objectId}`);if(callback)callback(createSlideResponse);});}catch(err){document.getElementById('content').innerText=err.message;return;}}
/** * Creates a new slide in a presentation. * @param {string} presentationId The presentation ID. * @param {string} pageId The object ID for the new slide. */asyncfunctioncreateSlide(presentationId,pageId){const{GoogleAuth}=require('google-auth-library');const{google}=require('googleapis');constauth=newGoogleAuth({scopes:'https://www.googleapis.com/auth/presentations',});constservice=google.slides({version:'v1',auth});constrequests=[{createSlide:{objectId:pageId,insertionIndex:'1',slideLayoutReference:{predefinedLayout:'TITLE_AND_TWO_COLUMNS',},},},];// If you wish to populate the slide with elements, add element create requests here,// using the pageId.// Execute the request.try{constres=awaitservice.presentations.batchUpdate({presentationId,resource:{requests,},});console.log(`Created slide with ID: ${res.data.replies[0].createSlide.objectId}`,);returnres;}catch(err){// TODO (developer) - handle exceptionthrowerr;}}
importgoogle.authfromgoogleapiclient.discoveryimportbuildfromgoogleapiclient.errorsimportHttpErrordefcreate_slide(presentation_id,page_id):""" Creates the Presentation the user has access to. Load pre-authorized user credentials from the environment. TODO(developer) - See https://developers.google.com/identity for guides on implementing OAuth2 for the application.\n """creds,_=google.auth.default()# pylint: disable=maybe-no-membertry:service=build("slides","v1",credentials=creds)# Add a slide at index 1 using the predefined# 'TITLE_AND_TWO_COLUMNS' layout and the ID page_id.requests=[{"createSlide":{"objectId":page_id,"insertionIndex":"1","slideLayoutReference":{"predefinedLayout":"TITLE_AND_TWO_COLUMNS"},}}]# If you wish to populate the slide with elements,# add element create requests here, using the page_id.# Execute the request.body={"requests":requests}response=(service.presentations().batchUpdate(presentationId=presentation_id,body=body).execute())create_slide_response=response.get("replies")[0].get("createSlide")print(f"Created slide with ID:{(create_slide_response.get('objectId'))}")exceptHttpErroraserror:print(f"An error occurred: {error}")print("Slides not created")returnerrorreturnresponseif__name__=="__main__":# Put the presentation_id, Page_id of slides whose list needs# to be submitted.create_slide("12SQU9Ik-ShXecJoMtT-LlNwEPiFR7AadnxV2KiBXCnE","My4ndpage")
body=Google::Apis::SlidesV1::Presentation.newrequests=[{create_slide:{object_id_prop:page_id,insertion_index:'1',slide_layout_reference:{predefined_layout:'TITLE_AND_TWO_COLUMNS'}}}]# If you wish to populate the slide with elements, add element create requests here,# using the page_id.# Execute the request.req=Google::Apis::SlidesV1::BatchUpdatePresentationRequest.new(requests:requests)response=slides_service.batch_update_presentation(presentation_id,req)create_slide_response=response.replies[0].create_slideputs"Created slide with ID: #{create_slide_response.object_id}"
بعد إنشاء الشريحة، يمكنك إضافة نص وأشكال إليها.
ملء العناصر النائبة
تحتوي التنسيقات عادةً على أشكال عناصر نائبة يتم نسخها إلى الشريحة عند
إنشائها. تتيح لك سمة CreateSlideRequest تحديد أرقام تعريف العناصر المستخدَمة لهذه العناصر النائبة
المنسوخة من خلال الحقل placeholderIdMappings. يتيح لك ذلك تعديل العناصر النائبة المنسوخة في طلب batchUpdate نفسه، ما يؤدي إلى تحسين الأداء وتوفير الحصة. لمزيد من المعلومات، يُرجى الاطّلاع على
نموذج CreateSlideRequest.
تاريخ التعديل الأخير: 2024-12-21 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","easyToUnderstand","thumb-up"],["ساعَدني المحتوى في حلّ مشكلتي.","solvedMyProblem","thumb-up"],["غير ذلك","otherUp","thumb-up"]],[["لا يحتوي على المعلومات التي أحتاج إليها.","missingTheInformationINeed","thumb-down"],["الخطوات معقدة للغاية / كثيرة جدًا.","tooComplicatedTooManySteps","thumb-down"],["المحتوى قديم.","outOfDate","thumb-down"],["ثمة مشكلة في الترجمة.","translationIssue","thumb-down"],["مشكلة في العيّنات / التعليمات البرمجية","samplesCodeIssue","thumb-down"],["غير ذلك","otherDown","thumb-down"]],["تاريخ التعديل الأخير: 2024-12-21 (حسب التوقيت العالمي المتفَّق عليه)"],[[["This page provides instructions on adding new slides to existing Google Slides presentations."],["You need the presentation ID to add a slide, which can be found in the presentation's URL."],["The `batchUpdate()` method and `CreateSlideRequest` are used to add slides, with the new slide's ID returned in the response."],["Slides can be further customized by adding text, shapes, and filling in placeholders after creation."],["The `placeholderIdMappings` field in `CreateSlideRequest` allows for efficient modification of copied placeholders during the slide creation process."]]],[]]