Word დოკუმენტების შერწყმა

MS Word ფაილები პოპულარული საოფისე ფაილის ფორმატებია მონაცემთა დამუშავებისა და ინფორმაციის გაზიარებისთვის. მრავალი რესურსი მუშაობს ორგანიზაციებში და აწარმოებს უამრავ დოკუმენტს ყოველდღიურად და მონაცემთა არქივებისთვის, ჩვენ შეიძლება წავაწყდეთ შორეულ გეოგრაფიულ ადგილებში მდებარე მრავალი გუნდის მიერ წარმოებული დოკუმენტების გაერთიანების მოთხოვნას. ამ სტატიაში ჩვენ განვიხილავთ ნაბიჯებს, თუ როგორ გავაერთიანოთ მრავალი Word ფაილი ერთ შედეგზე REST API-ს გამოყენებით.

სიტყვების დამუშავების REST API

Word დოკუმენტებს აქვს სხვადასხვა ფორმატი და ამ მოთხოვნის შესასრულებლად Aspose.Words Cloud გთავაზობთ MS Word-ისა და OpenOffice-ის სხვადასხვა დოკუმენტების ერთ ფაილში გაერთიანების შესაძლებლობებს. API საშუალებას გაძლევთ დაურთოთ დოკუმენტი ან დოკუმენტები, რომლებიც მითითებულია documentList პარამეტრში, ორიგინალური რესურსის ფაილს. ცვლილებები ინახება რესურსის ორიგინალ დოკუმენტში, თუ destFileName პარამეტრი არ არის მითითებული. დოკუმენტების დანართის დროს, ჩვენ ვიღებთ შესაძლებლობას განვსაზღვროთ რომელი ფორმატირება იქნება გამოყენებული: დამატებული ან დანიშნულების დოკუმენტი. ასე რომ, შესაძლო მნიშვნელობებია KeepSourceFormatting ან UseDestinationStyles.

ფაილების გაერთიანება cURL ბრძანების გამოყენებით

cURL ბრძანებები ყველაზე მარტივი გზაა Word დოკუმენტის შერწყმის ოპერაციის შესასრულებლად RESTful API-ების გამოყენებით.

curl -X PUT "https://api.aspose.cloud/v4.0/words/Working%20with%20Header_Footer%20Objects.docx/appendDocument?destFileName=MergedFile.doc" \
-H  "accept: application/json" \
-H  "Authorization: Bearer <JWT Token>" \
-H  "Content-Type: application/json" \
-d "{\"DocumentEntries\":[{\"Href\":\"Another sample file.docx\",\"ImportFormatMode\":\"KeepSourceFormatting\"}],\"ApplyBaseDocumentHeadersAndFootersToAppendingDocuments\":true}"

მოითხოვეთ URL

https://api.aspose.cloud/v4.0/words/Working%20with%20Header_Footer%20Objects.docx/appendDocument?destFileName=MergedFile.doc

Word ფაილების შერწყმა C#-ის გამოყენებით

C#.NET

string MyAppKey = "xxxxxxxx";    // Get AppKey and AppSID from https://dashboard.aspose.cloud/
string MyAppSid = "xxxxxxxxx";   // Get AppKey and AppSID from https://dashboard.aspose.cloud/

public class AppendaDocument
{
    public static void Run()
    {
        WordsApi wordsApi = new WordsApi(MyAppKey,MyAppSid);

        try
        {
            string fileName = "Working with Header_Footer Objects.docx";
            string documentToAppend = "Another sample file.docx";
            //  string საქაღალდე = ""; // ფაილი არსებობს საცავის ძირში
            string destName = "Out_Merged.docx"; // // Changes will be made in the source document


            var body = new Aspose.Words.Cloud.Sdk.Model.DocumentEntryList();
            System.Collections.Generic.List<Aspose.Words.Cloud.Sdk.Model.DocumentEntry> docEntries = new System.Collections.Generic.List<Aspose.Words.Cloud.Sdk.Model.DocumentEntry>();

            Aspose.Words.Cloud.Sdk.Model.DocumentEntry docEntry = new Aspose.Words.Cloud.Sdk.Model.DocumentEntry { Href = documentToAppend, ImportFormatMode = "KeepSourceFormatting" };
            docEntries.Add(docEntry);
            body.DocumentEntries = docEntries;

            Aspose.Words.Cloud.Sdk.Model.Requests.AppendDocumentRequest request = new Aspose.Words.Cloud.Sdk.Model.Requests.AppendDocumentRequest(fileName, body, null, null,null,null, destName, null, null);
            Aspose.Words.Cloud.Sdk.Model.DocumentResponse result = wordsApi.AppendDocument(request);

        }
        catch (Exception e)
        {
            Console.WriteLine(e.ToString());
        }
    }
}

რეკომენდებული სტატიები

ჩვენ ასევე გირჩევთ ეწვიოთ შემდეგ სტატიებს მეტის გასაგებად: