예제 #1
0
        public static void Run()
        {
            // ExStart:1
            WordsApi   wordsApi   = new WordsApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH);
            StorageApi storageApi = new StorageApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH);

            String fileName = "SampleWordDocument.docx";
            int    index    = 0;
            int    runIndex = 0;
            String storage  = null;
            String folder   = null;

            try
            {
                // Upload the file
                storageApi.PutCreate(fileName, "", storage, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
                // Invoke Aspose.Words Cloud SDK API to get font informations of a run from word document
                FontResponse apiResponse = wordsApi.GetDocumentParagraphRunFont(fileName, index, runIndex, storage, folder);

                if (apiResponse != null && apiResponse.Status.Equals("OK"))
                {
                    Font runFont = apiResponse.Font;
                    Console.WriteLine("Font Name : " + runFont.Name);
                    Console.WriteLine("Style : " + runFont.StyleName);
                    Console.WriteLine("Size : " + runFont.Size);
                    Console.ReadKey();
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
            }
            // ExEnd:1
        }
예제 #2
0
 public void Process(ISemanticProcessor proc, IMembrane membrane, FontResponse resp)
 {
     resp.Context.Response.ContentType     = resp.ContentType;
     resp.Context.Response.ContentEncoding = Encoding.UTF8;
     resp.Context.Response.ContentLength64 = resp.BinaryData.Length;
     resp.Context.Response.OutputStream.Write(resp.BinaryData, 0, resp.BinaryData.Length);
     resp.Context.Response.Close();
 }
예제 #3
0
 public void Process(ISemanticProcessor proc, IMembrane membrane, FontResponse resp)
 {
     resp.Context.Response.ContentType = resp.ContentType;
     resp.Context.Response.ContentEncoding = Encoding.UTF8;
     resp.Context.Response.ContentLength64 = resp.BinaryData.Length;
     resp.Context.Response.OutputStream.Write(resp.BinaryData, 0, resp.BinaryData.Length);
     resp.Context.Response.Close();
 }
        public static void Run()
        {
            // ExStart:1
            WordsApi   wordsApi   = new WordsApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH);
            StorageApi storageApi = new StorageApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH);

            string fileName     = "SampleWordDocument.docx";
            string destFileName = "updated-" + fileName;
            int    index        = 0;
            int    runIndex     = 0;
            string storage      = null;
            string folder       = null;

            Font body = new Font();

            body.Bold = true;
            body.Size = 31.0;
            body.Name = "Calibri";

            try
            {
                // Upload the file
                storageApi.PutCreate(fileName, "", storage, System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));
                // Invoke Aspose.Words Cloud SDK API to update font of run
                FontResponse apiResponse = wordsApi.PostDocumentParagraphRunFont(fileName, index, runIndex, storage, folder, destFileName, body);

                if (apiResponse != null && apiResponse.Status.Equals("OK"))
                {
                    Console.WriteLine("paragraph run font has been updated successfully");
                    Console.ReadKey();
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
            }
            // ExEnd:1
        }
예제 #5
0
 public void Process(ISemanticProcessor proc, IMembrane membrane, FontResponse resp)
 {
     resp.Context.Response.ContentLength64 = resp.BinaryData.Length;
     resp.Context.Response.Write(resp.BinaryData, resp.ContentType);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="UpdateRunFontOnlineResponse"/> class.
 /// </summary>
 /// <param name="model">The response model.</param>
 /// <param name="document">The document after modification.</param>
 public UpdateRunFontOnlineResponse(FontResponse model, System.IO.Stream document)
 {
     this.Model    = model;
     this.Document = document;
 }