Thai
 Thai

โปรแกรมแก้ไข Word, Excel, PowerPoint และ PDF สำหรับ .NET และ Java

ใช้โปรแกรมแก้ไข HTML ที่คุณเลือกสำหรับแก้ไขไฟล์ PDF, DOCX, XLSX, PPTX, ODT, XPS, TXT, RTF, HTML และไฟล์ประเภทอื่นๆ อีกมากมายใน .NET และ Java โดยสร้างแอปแก้ไขเอกสารที่มีคุณลักษณะหลากหลาย

ลองใช้ API ของเราฟรีรับใบอนุญาตชั่วคราว

API ที่ไม่ขึ้นกับแพลตฟอร์มเพื่อแก้ไข PDF, เอกสาร Word, สเปรดชีต, งานนำเสนอ และไฟล์ข้อมูลอื่นๆ

การแก้ไขเอกสารในบริบทของการแก้ไขไฟล์ดิจิทัลหมายถึงกระบวนการแก้ไขข้อความ รูปภาพ หรือองค์ประกอบอื่นๆ ภายในเอกสาร การแก้ไขไฟล์ข้อมูลแบบดิจิทัลสามารถใช้เพื่อปรับปรุงความถูกต้องและชัดเจนของเนื้อหา เพิ่มการแก้ไขเนื้อหาที่มีอยู่ ทำให้เอกสารอ่านง่ายขึ้น และอื่นๆ อีกมากมาย ด้วยการใช้เอกสารดิจิทัลประเภทต่างๆ เพิ่มมากขึ้น ความจำเป็นในการแก้ไขเอกสารดิจิทัลจึงมีความสำคัญมากขึ้นเรื่อยๆ

ความสามารถในการแก้ไขเอกสารดิจิทัลทางอิเล็กทรอนิกส์ได้กลายเป็นทักษะที่จำเป็นสำหรับทุกคนที่ทำงานกับเอกสาร การรู้วิธีแก้ไข PDF, Microsoft Office และไฟล์ข้อมูลอื่นๆ อย่างรวดเร็วและแม่นยำสามารถช่วยประหยัดเวลาได้มาก เพื่อจุดประสงค์นี้ คุณสามารถใช้ API ของ GroupDocs.Editor ที่รองรับการแก้ไขอาร์เรย์ของรูปแบบไฟล์ข้อมูลยอดนิยม เช่น PDF, Word, Excel, PowerPoint, OpenDocument, RTF, Text, HTML, eBooks และอื่นๆ อีกมากมายทั่วทั้งแพลตฟอร์ม .NET และ Java .

เริ่มต้นใช้งาน

หากต้องการเริ่มแก้ไขเอกสารของคุณใน .NET หรือ Java คุณต้องติดตั้ง GroupDocs.Editor เวอร์ชันที่จำเป็นก่อน โปรดดูคำแนะนำที่ใช้ร่วมกันในส่วนต่อไปนี้สำหรับการตั้งค่า GroupDocs.Editor สำหรับ .NET หรือ Java อย่างถูกต้อง

GroupDocs.Editor สำหรับการติดตั้ง .NET

โปรดดาวน์โหลดโปรแกรมติดตั้ง DLLs หรือ MSI จากส่วนการดาวน์โหลด หรือใช้ NuGet เพื่อติดตั้ง API คุณยังสามารถใช้ Package Manager Console:

PM> Install-Package GroupDocs.Editor 

หากต้องการความช่วยเหลือเพิ่มเติมเกี่ยวกับการติดตั้ง โปรดดูคู่มือนี้

GroupDocs.Editor สำหรับการติดตั้ง Java

สำหรับเวอร์ชัน Java คุณสามารถดาวน์โหลดไฟล์ JAR จากส่วนการดาวน์โหลด หรือเพิ่มการกำหนดค่าต่อไปนี้สำหรับที่เก็บและ การพึ่งพาในแอป Java (ที่ใช้ Maven) ของคุณ:

<repository>
<id>GroupDocsJavaAPI</id>
    <name>GroupDocs Java API</name> 
    <url>https://repository.groupdocs.com/repo/</url>
</repository>
<dependency>
        <groupId>com.groupdocs</groupId>
            <artifactId>groupdocs-editor</artifactId>
        <version>20.11</version> 
</dependency>

โปรดอ่านคู่มือการติดตั้งนี้ หากคุณต้องการข้อมูลเพิ่มเติม

กรณีใช้สำหรับแก้ไข PDF และไฟล์ข้อมูลอื่นๆ

ตอนนี้คุณตั้งค่าเวอร์ชัน API ที่ถูกต้องเสร็จแล้ว มาดูสถานการณ์กรณีที่ใช้กันอย่างแพร่หลายสำหรับการแก้ไขเอกสารหลายรูปแบบของคุณกัน

กรณีใช้สำหรับแก้ไข PDF และไฟล์ข้อมูลอื่นๆ

เรียนรู้การแก้ไขเอกสาร PDF ในแอพ .NET ของคุณ

รูปแบบ PDF เป็นประเภทไฟล์ที่นิยมใช้สำหรับเอกสาร รายงาน และเนื้อหาดิจิทัลอื่นๆ ย่อมาจาก Portable Document Format และใช้กันอย่างแพร่หลายเนื่องจากความสามารถในการสร้างเอกสารคุณภาพสูงที่แบ่งปันได้ง่าย ซึ่งแตกต่างจากรูปแบบไฟล์ข้อมูลยอดนิยมอื่น ๆ เนื่องจากมีเค้าโครงที่ตายตัวและคงไว้ซึ่งรูปแบบและเค้าโครงเดียวกัน โดยไม่คำนึงถึงอุปกรณ์และระบบปฏิบัติการที่คุณกำลังอ่านหรือดู

แต่ถ้าคุณต้องการเปลี่ยนแปลงเอกสาร PDF ล่ะ การแก้ไขไฟล์ PDF อาจเป็นกระบวนการที่ยุ่งยาก แต่ไม่จำเป็นต้องเป็นเช่นนั้นหากคุณใช้ GroupDocs.Editor สำหรับ .NET API API นี้ทำให้คุณสามารถแก้ไขไฟล์ PDF โดยใช้โปรแกรมแก้ไขแบบ WYSIWYG เช่นเดียวกับเอกสารอื่นๆ ปัจจุบัน การแก้ไข PDF ได้รับการสนับสนุนเฉพาะใน GroupDocs.Editor API เวอร์ชัน .NET และไม่รองรับในเวอร์ชัน Java

เรียนรู้การแก้ไขเอกสาร PDF ในแอพ .NET ของคุณ

การแก้ไขเอกสาร PDF ใน .NET

โปรดใช้โค้ดต่อไปนี้เพื่อโหลด แก้ไข และบันทึกไฟล์ PDF ใน .NET:

  //1. Simple preparations of input data
const string filename = "sample.pdf";
const string password = "password"; 
string inputPath = System.IO.Path.Combine(Common.TestHelper.PdfFolder, filename);
//2. Create a load options class with password
GroupDocs.Editor.Options.PdfLoadOptions loadOptions = new PdfLoadOptions();
loadOptions.Password = password;
//3. Create edit options and tune/adjust if necessary
GroupDocs.Editor.Options.PdfEditOptions editOptions = new PdfEditOptions();
editOptions.EnablePagination = true; //Enable pagination for per-page processing in WYSIWYG-editor
editOptions.Pages = PageRange.FromStartPageTillEnd(3); //Edit not all pages, but starting from 3rd and till the end
//4. Create an Editor instance, load a document
GroupDocs.Editor.Editor editor = new Editor(inputPath, delegate () { return loadOptions; });
//5. Edit a document and generate EditableDocument
GroupDocs.Editor.EditableDocument originalDoc = editor.Edit(editOptions);
//6. Generate HTML/CSS, send it to WYSIWYG, edit there, and obtain edited version
string originalContent = originalDoc.GetEmbeddedHtml();
string editedContent = originalContent.Replace(".NET Framework", "I love Java!!!");
//7. Generate EditableDocument from edited content
EditableDocument editedDoc = EditableDocument.FromMarkup(editedContent, null);
//8. Create and adjust save options
GroupDocs.Editor.Options.PdfSaveOptions saveOptions = new PdfSaveOptions();
saveOptions.Compliance = PdfCompliance.Pdf20;
//9. Save to a file or a stream
string outputPath = System.IO.Path.Combine(Common.TestHelper.OutputFolder, filename);
editor.Save(editedDoc, outputPath, saveOptions);
//10. Don't forget to dispose all resources
originalDoc.Dispose();
editedDoc.Dispose();
editor.Dispose(); 

จะแก้ไขเอกสารประมวลผลคำ สเปรดชีต และงานนำเสนอใน .NET และ Java ได้อย่างไร

Microsoft Word, Excel และ PowerPoint เป็นรูปแบบที่ใช้กันอย่างแพร่หลายในการสร้างเอกสาร สเปรดชีต และงานนำเสนอตามลำดับ ซึ่งใช้เป็นรูปแบบมาตรฐานในธุรกิจและองค์กรส่วนใหญ่ และเป็นเครื่องมือที่จำเป็นสำหรับทุกคนที่ต้องการจัดระเบียบ วิเคราะห์ และนำเสนอข้อมูลอย่างมีประสิทธิภาพ

คุณต้องการแก้ไขรูปแบบเอกสารเหล่านี้ทางโปรแกรมใน .NET หรือ Java หรือไม่ ถ้าใช่ คุณสามารถใช้ API ของ GroupDocs.Editor และแก้ไขเอกสาร Microsoft Word, Excel และ PowerPoint และคุณไม่จำเป็นต้องติดตั้ง Microsoft Office ในระบบของคุณด้วยซ้ำ

จะแก้ไขเอกสารประมวลผลคำ สเปรดชีต และงานนำเสนอใน .NET และ Java ได้อย่างไร

การแก้ไขเอกสาร Word ในแอป .NET ของคุณ

หากต้องการแก้ไขเอกสารคำ (DOCX) ใน .NET โปรดใช้รหัสนี้:

    using (FileStream fs = File.OpenRead("filepath/document.docx"))
{   
    // Load Document
    Options.WordProcessingLoadOptions loadOptions = new WordProcessingLoadOptions();
    loadOptions.Password = "password-if-any";
    // Edit Document
    using (Editor editor = new Editor(delegate { return fs; }, delegate { return loadOptions; }))
    {
        Options.WordProcessingEditOptions editOptions = new WordProcessingEditOptions();
        editOptions.FontExtraction = FontExtractionOptions.ExtractEmbeddedWithoutSystem;
        editOptions.EnableLanguageInformation = true;
        editOptions.EnablePagination = true;
        using (EditableDocument beforeEdit = editor.Edit(editOptions))
        {
            string originalContent = beforeEdit.GetContent();
            List allResources = beforeEdit.AllResources;
            string editedContent = originalContent.Replace("document", "edited document");
            // Save Document
            using (EditableDocument afterEdit = EditableDocument.FromMarkup(editedContent, allResources))
            {
                WordProcessingFormats docxFormat = WordProcessingFormats.Docx;
                Options.WordProcessingSaveOptions saveOptions = new WordProcessingSaveOptions(docxFormat);
                saveOptions.EnablePagination = true;
                saveOptions.Locale = System.Globalization.CultureInfo.GetCultureInfo("en-US");
                saveOptions.OptimizeMemoryUsage = true;
                saveOptions.Password = "password";
                saveOptions.Protection = new WordProcessingProtection(WordProcessingProtectionType.ReadOnly, "write_password");
                using (FileStream outputStream = File.Create("filepath/editedDocument.docx"))
                {
                    editor.Save(afterEdit, outputStream, saveOptions);
                }
            }
        }
    }
} 

แก้ไขไฟล์ Microsoft Word ใน Java

สำหรับการแก้ไขเอกสาร Word ในภาษา Java โปรดใช้โค้ดต่อไปนี้:

    // Edit the Word DOC/DOCX documents in Java
Options.WordProcessingLoadOptions loadOptions = new WordProcessingLoadOptions();
loadOptions.setPassword("password-if-any");
Editor editor = new Editor("path/document.docx", loadOptions);
EditableDocument defaultWordProcessingDoc = editor.edit();
// Either edit using any WYSIWYG editor or edit programmatically
String allEmbeddedInsideString = defaultWordProcessingDoc.getEmbeddedHtml();
String allEmbeddedInsideStringEdited = allEmbeddedInsideString.replace("document", "edited document");
// Save the edited document
EditableDocument editedDoc = EditableDocument.fromMarkup(allEmbeddedInsideStringEdited, null);
WordProcessingSaveOptions saveOptions = new WordProcessingSaveOptions(WordProcessingFormats.Docx);
editor.save(editedDoc, "path/edited-document.docx", saveOptions); 

การแก้ไขสเปรดชีต Excel ใน .NET

คุณสามารถแก้ไขเอกสาร Excel ใน .NET โดยใช้รหัส C# ต่อไปนี้:

Options.SpreadsheetLoadOptions loadOptions = new SpreadsheetLoadOptions();
loadOptions.Password = "password";
// Load the Spreadsheet
Editor editor = new Editor("path/spreadsheet.xlsx", delegate { return loadOptions; });
// Get 1st tab of the Spreadsheet
SpreadsheetEditOptions sheetTab1EditOptions = new SpreadsheetEditOptions();
sheetTab1EditOptions.WorksheetIndex = 0; // first worksheet
// Obtain HTML markup from some EditableDocument instance
EditableDocument firstTab = editor.Edit(sheetTab1EditOptions);
string bodyContent = firstTab.GetBodyContent(); // HTML markup from inside the HTML -> BODY element
string allContent = firstTab.GetContent();      // Full HTML markup of all document, with HTML -> HEAD header and all its content
List onlyImages = firstTab.Images;
List allResourcesTogether = firstTab.AllResources;
string editedContent = allContent.Replace("Company Name", "New Company Name");
EditableDocument afterEdit = EditableDocument.FromMarkup(editedContent, allResourcesTogether);
// Create save options
SpreadsheetFormats xlsxFormat = SpreadsheetFormats.Xlsx;
Options.SpreadsheetSaveOptions saveOptions = new SpreadsheetSaveOptions(SpreadsheetFormats.Xlsx);
// Set new opening password
saveOptions.Password = "newPassword";
saveOptions.WorksheetProtection = new WorksheetProtection(WorksheetProtectionType.All, "WriteProtectionPassword");
// Create output stream
using (FileStream outputStream = File.Create("path/editedSpreadsheet.xlsx"))
{
    editor.Save(afterEdit, outputStream, saveOptions);
} 

แก้ไขเอกสาร Microsoft Excel ใน Java

หากต้องการแก้ไข Excel สเปรดชีตใน Java คุณสามารถใช้ข้อมูลโค้ดนี้:

// Edit the Excel XLS/XLSX documents in Java
SpreadsheetLoadOptions loadOptions = new SpreadsheetLoadOptions();
loadOptions.setPassword("password-if-any");
// Loading Spreadsheet
Editor editor = new Editor("path/sample_sheet.xlsx", loadOptions);
// Edit 1st tab of the Spreadsheet
SpreadsheetEditOptions editOptions = new SpreadsheetEditOptions();
editOptions.setWorksheetIndex(0); // index is 0-based, so this is 1st tab
EditableDocument firstTab = editor.edit(editOptions);
String bodyContent = firstTab.getBodyContent();
String allContent = firstTab.getContent();
List onlyImages = firstTab.getImages();
List allResourcesTogether = firstTab.getAllResources();
String editedSheetContent = allContent.replace("Old Company Name","New Company Name");
EditableDocument editedDoc = EditableDocument.fromMarkup(editedSheetContent, null);
SpreadsheetSaveOptions saveOptions = new SpreadsheetSaveOptions(SpreadsheetFormats.Xlsx);
saveOptions.setPassword("new-password");
editor.save(editedDoc, "path/edited_spreadsheet.xlsx", saveOptions);
firstTab.dispose();
editor.dispose()

ในทำนองเดียวกัน คุณสามารถแก้ไขงานนำเสนอ PowerPoint ได้โดยใช้ GroupDocs.Editor API โปรดตรวจสอบ .NET และ การแก้ไข Java สำหรับความช่วยเหลือเพิ่มเติม

เรียนรู้การแก้ไขเอกสารข้อความใน .NET และ Java และสร้างแอปแก้ไขข้อความของคุณเอง

ไฟล์ข้อความ (แสดงโดย TXT) เป็นหนึ่งในรูปแบบไฟล์ที่ใช้บ่อยที่สุด เนื่องจากมีน้ำหนักเบา เรียบง่าย และง่ายต่อการสร้างและแบ่งปัน มีการใช้ในรูปแบบต่างๆ ตั้งแต่การเขียนโค้ดไปจนถึงการสร้างเอกสารแบบข้อความล้วน เอกสารข้อความไม่มีการจัดรูปแบบข้อความ รูปภาพ แบบฟอร์ม ตาราง หรือองค์ประกอบ Rich-text อื่นใด

GroupDocs.Editor API รองรับการแก้ไขไฟล์ข้อความในแพลตฟอร์ม .NET และ Java คุณสามารถรวมคุณลักษณะการแก้ไขเอกสารข้อความเข้ากับแอปพลิเคชันที่มีอยู่ของคุณ และเพิ่มความสามารถหรือสร้างแอปแก้ไขข้อความของคุณเองเพื่อจุดประสงค์นี้

เรียนรู้การแก้ไขเอกสารข้อความใน .NET และ Java และสร้างแอปแก้ไขข้อความของคุณเอง

แก้ไขเอกสารข้อความในแพลตฟอร์ม .NET

โค้ดตัวอย่างด้านล่างสามารถใช้เพื่อ แก้ไขไฟล์ข้อความใน .NET ไฟล์ที่แก้ไขสามารถบันทึกในรูปแบบ TXT และการประมวลผลคำ (DOCM):

//Load the text file
string inputTxtPath = "C://input/file.txt";
Editor editor = new Editor(inputTxtPath);
TextEditOptions editOptions = new TextEditOptions();
editOptions.Encoding = System.Text.Encoding.UTF8;
editOptions.RecognizeLists = true;
editOptions.LeadingSpaces = TextLeadingSpacesOptions.ConvertToIndent;
editOptions.TrailingSpaces = TextTrailingSpacesOptions.Trim;
editOptions.Direction = TextDirection.Auto;
EditableDocument beforeEdit = editor.Edit(editOptions); // Create EditableDocument instance
string originalTextContent = beforeEdit.GetContent(); // Get HTML content
string updatedTextContent = originalTextContent.Replace("text", "EDITED text"); // Edit the content
List allResources = beforeEdit.AllResources; // Get resources (only one stylesheet in this case)
//Finally, create new EditableDocument
EditableDocument afterEdit = EditableDocument.FromMarkup(updatedTextContent, allResources);\
//Save the edited document to TXT and DOCM format
TextSaveOptions txtSaveOptions = new TextSaveOptions();
txtSaveOptions.AddBidiMarks = true;
txtSaveOptions.PreserveTableLayout = true;
WordProcessingSaveOptions wordSaveOptions = new WordProcessingSaveOptions(WordProcessingFormats.Docm);
string outputTxtPath = "C:\output\document.txt";
string outputWordPath = "C:\output\document.docm";
editor.Save(afterEdit, outputTxtPath, txtSaveOptions);
editor.Save(afterEdit, outputWordPath, wordSaveOptions); 

การแก้ไขเอกสารข้อความ (TXT) ใน Java

ในการแก้ไขไฟล์ข้อความใน Java คุณสามารถใช้รหัสที่แสดงด้านล่างนี้ จากนั้น คุณสามารถบันทึกเอกสารที่แก้ไขเป็นรูปแบบไฟล์ TXT หรือ Word (DOCM) ได้:

// Loading the text document
String inputTxtPath = "C://input//file.txt";
Editor editor = new Editor(inputTxtPath);
TextEditOptions editOptions = new TextEditOptions();
editOptions.setEncoding(StandardCharsets.UTF_8);
editOptions.setRecognizeLists(true);
editOptions.setLeadingSpaces(TextLeadingSpacesOptions.ConvertToIndent);
editOptions.setTrailingSpaces(TextTrailingSpacesOptions.Trim);
editOptions.setDirection(TextDirection.Auto);
EditableDocument beforeEdit = editor.edit(editOptions); // Create EditableDocument instance
String originalTextContent = beforeEdit.getContent(); // Get HTML content
String updatedTextContent = originalTextContent.replace("text", "EDITED text"); // Edit the content
List allResources = beforeEdit.getAllResources(); // Get resources (only one stylesheet actually in this case)
//Finally, create new EditableDocument
EditableDocument afterEdit = EditableDocument.fromMarkup(updatedTextContent, allResources);
//Saving the modified file to TXT and DOCM formats
TextSaveOptions txtSaveOptions = new TextSaveOptions();
txtSaveOptions.setAddBidiMarks(true);
txtSaveOptions.setPreserveTableLayout(true);
WordProcessingSaveOptions wordSaveOptions = new WordProcessingSaveOptions(WordProcessingFormats.Docm);
String outputTxtPath = "C:\\output\\document.txt";
String outputWordPath = "C:\\output\\document.docm";
editor.save(afterEdit, outputTxtPath, txtSaveOptions);
editor.save(afterEdit, outputWordPath, wordSaveOptions);  

รูปแบบเอกสารอีเมลคืออะไร และคุณจะแก้ไขได้อย่างไรใน .NET และ Java

เอกสารอีเมลคือไฟล์ที่มีเนื้อหาของข้อความอีเมล รวมถึงเนื้อหาของข้อความและไฟล์แนบใดๆ โดยทั่วไปไฟล์เหล่านี้ใช้สำหรับถ่ายโอนข้อความอีเมลระหว่างไคลเอ็นต์อีเมลต่างๆ หรือจัดเก็บในรูปแบบมาตรฐาน ไคลเอนต์อีเมลต่างๆ เช่น Microsoft Outlook, Apple Mail และ Mozilla Thunderbird ใช้งาน เอกสารเหล่านี้เป็นส่วนสำคัญของวิธีที่เราสื่อสารกันในยุคดิจิทัล

ด้วยการใช้ไฟล์ประเภทเหล่านี้เพิ่มขึ้น การแก้ไขไฟล์จึงกลายเป็นเรื่องธรรมดา การทำกระบวนการแก้ไขให้เป็นอัตโนมัตินั้นมีประโยชน์อย่างมาก ไม่ว่าคุณจะต้องการรวมกระบวนการกับระบบอื่น หรือรวมตรรกะแบบกำหนดเอง GroupDocs.Editor APIs (สำหรับ .NET และ Java) ช่วยให้คุณทำเช่นนั้นได้ คุณสามารถแก้ไขเอกสารอีเมลในรูปแบบยอดนิยมได้โดยใช้ API เหล่านี้

รูปแบบเอกสารอีเมลคืออะไร และคุณจะแก้ไขได้อย่างไรใน .NET และ Java

จะแก้ไขเอกสารอีเมลใน. NET ได้อย่างไร?

หากคุณต้องการโหลด แก้ไข และบันทึกข้อความอีเมล (MSG) โปรดใช้ตัวเลือกนี้ รหัส C#:

//1. Prepare a sample file
const string msgFilename = "ComplexExample.msg";
string msgInputPath = System.IO.Path.Combine(Common.TestHelper.EmailFolder, msgFilename);
//2. Load to the Editor class
Editor msgEditor = new Editor(msgInputPath);
//3. Create edit options with all content
Options.EmailEditOptions editOptions = new EmailEditOptions(MailMessageOutput.All);
//4. Generate an editable document
EditableDocument originalDoc = msgEditor.Edit(editOptions);
//5. Emit HTML from EditableDocument, send it to the client-side, edit it there in WYSIWYG-editor (omitted here)
string savedHtmlContent = originalDoc.GetEmbeddedHtml();
//6. Obtain edited content from the client-side and generate a new EditableDocument from it (omitted here)
EditableDocument editedDoc = EditableDocument.FromMarkup(savedHtmlContent, null);
//7. Create 1st save options
EmailSaveOptions saveOptions1 = new EmailSaveOptions(MailMessageOutput.Common);
//8. Create 2nd save options
EmailSaveOptions saveOptions2 = new EmailSaveOptions(MailMessageOutput.Body | MailMessageOutput.Attachments);
//9. Generate and save 1st output MSG to the file
string outputMsgPath = System.IO.Path.Combine(Common.TestHelper.OutputFolder, "OutputFile.msg");
msgEditor.Save(editedDoc, outputMsgPath, saveOptions1);
//10. Generate and save 2nd output MSG to the stream
Stream outputMsgStream = File.Create(Path.Combine(Common.TestHelper.OutputFolder, "OutputStream.msg"));
msgEditor.Save(editedDoc, outputMsgStream, saveOptions2);
//11. Dispose all resources
outputMsgStream.Dispose();
editedDoc.Dispose();
originalDoc.Dispose();
msgEditor.Dispose(); 

การแก้ไขเอกสารอีเมลใน Java

สำหรับโหลด แก้ไข และบันทึกไฟล์ข้อความอีเมล (MSG) คุณสามารถใช้รหัสต่อไปนี้ :

//1. Prepare a sample file
String msgInputPath = "C:\ComplexExample.msg";
//2. Load to the Editor class
Editor msgEditor = new Editor(msgInputPath);
//3. Create edit options with all content
EmailEditOptions editOptions = new EmailEditOptions(MailMessageOutput.All);
//4. Generate an editable document
EditableDocument originalDoc = msgEditor.edit(editOptions);
//5. Emit HTML from EditableDocument, send it to the client-side, edit it there in WYSIWYG-editor (omitted here)
String savedHtmlContent = originalDoc.getEmbeddedHtml();
//6. Obtain edited content from the client-side and generate a new EditableDocument from it (omitted here)
EditableDocument editedDoc = EditableDocument.fromMarkup(savedHtmlContent, null);
//7. Create 1st save options
EmailSaveOptions saveOptions1 = new EmailSaveOptions(MailMessageOutput.Common);
//8. Create 2nd save options
EmailSaveOptions saveOptions2 = new EmailSaveOptions(MailMessageOutput.Body | MailMessageOutput.Attachments);
//9. Generate and save 1st output MSG to the file
String outputMsgPath = "C:\OutputFile.msg";
msgEditor.save(editedDoc, outputMsgPath, saveOptions1);
//10. Generate and save 2nd output MSG to the stream
Stream outputMsgStream = "C:\OutputStream.msg";
msgEditor.save(editedDoc, outputMsgStream, saveOptions2);
//11. Dispose all resources
outputMsgStream.dispose();
editedDoc.dispose();
originalDoc.dispose();
msgEditor.dispose(); 

คุณยังสามารถแก้ไข PDF, DOCX, XLSX, PPTX, ODT, ODS, RTF, TXT, CSV, XML, EPUB และเอกสารอื่นๆ อีกมากมายได้ทันทีโดยใช้ แอปแก้ไขเอกสารฟรีจากอุปกรณ์ที่คุณเลือก ดังนั้นโปรดลองใช้ดู

กำลังมองหาความช่วยเหลือ?

ตรวจสอบช่องทางการสนับสนุนของเราสำหรับความช่วยเหลือเกี่ยวกับคำถามของคุณเกี่ยวกับคุณสมบัติและการทำงาน API ของผลิตภัณฑ์ Conholdate

พร้อมที่จะเริ่มต้นหรือยัง

ดาวน์โหลดรุ่นทดลองใช้ฟรี ข้อมูลราคา