Есть ли способ отредактировать презентацию Google Slides из C # - PullRequest
0 голосов
/ 09 июля 2019

Я пытаюсь получить приложение ac # для подачи данных в приложение Google Slides, есть ли способ вставить текст в слайд с помощью API Google Slides или API

это для презентации сживая демонстрация, я пытался посмотреть на сайты разработчиков Google, я оценил презентацию, но не смог получить ничего более

  using System;
    using System.IO.Ports;
    using System.Threading;
    using Google.Apis.Auth.OAuth2;
    using Google.Apis.Slides.v1;
    using Google.Apis.Slides.v1.Data;
    using Google.Apis.Services;
    using Google.Apis.Util.Store;
    using System.Collections.Generic;
    using System.IO;
    using Google.Apis.Auth;
    using Google.Apis.Discovery;
    using Google.Apis.Drive;
    using Google.Apis.Drive.v3;
    using Google.Apis.Http;
    using Google.Apis.Logging;
    using Google.Apis.Requests;
    using Google.Apis.Slides;
    using Google.Apis.Testing;
    using Google.Apis.Upload;
    using Google.Apis.Util;
    using Google.Apis;


    public class PortChat
    {
        string tempatefile = "Section header";
        static bool _continue;
        static SerialPort _serialPort;

        static string[] Scopes = {DriveService.Scope.Drive, SlidesService.Scope.Drive};
        static string[] scope2 = { };
        static string ApplicationName = "Google Slides API .NET Quickstart";

        public static void Main()
        {
            UserCredential credential;

            using (var stream =

                new FileStream("C:/credentials/credentials.json", FileMode.Open, FileAccess.Read))

            {
                // The file token.json stores the user's access and refresh tokens, and is created 
                // automatically when the authorization flow completes for the first time. 
                string credPath = "token.json";

                credential = GoogleWebAuthorizationBroker.AuthorizeAsync(

                    GoogleClientSecrets.Load(stream).Secrets,

                    Scopes,

                    "user",

                    CancellationToken.None,

                    new FileDataStore(credPath, true)).Result;
                Console.WriteLine("Credential file saved to: " + credPath);
            }

            // Create Google Slides API service. 
            var service = new SlidesService(new BaseClientService.Initializer()

            {

                HttpClientInitializer = credential,

                ApplicationName = ApplicationName,

            });

            // Define request parameters. 
            String presentationId = "1qmbh4y5Zfzxo_mq5l8SzgLuKmKaC4DQzEib88a45js4";
            PresentationsResource.GetRequest request = service.Presentations.Get(presentationId);

            // Prints the number of slides and elements in a sample presentation: 
            // https://docs.google.com/presentation/d/1EAYk18WDjIG-zp_0vLm3CsfQh_i8eXc67Jo2O9C6Vuc/edit 
            Presentation presentation = request.Execute();
            IList<Page> slides = presentation.Slides;
            Console.WriteLine("The presentation contains {0} slides:", slides.Count);

            for (var i = 0; i < slides.Count; i++)
            {

                var slide = slides[i];
                Console.WriteLine("- Slide #{0} contains {1} elements.", i + 1, slide.PageElements.Count);

            }

        }

    }
...