日本語
 日本語

.NET および Java 用の Word、Excel、PowerPoint、および PDF エディター

豊富な機能を備えたドキュメント編集アプリを構築することで、お好みの HTML エディターを使用して、PDF、DOCX、XLSX、PPTX、ODT、XPS、TXT、RTF、HTML、およびその他の多くのファイル タイプを .NET および Java で編集できます。

API を無料で試す仮免許取得

PDF、ワード文書、スプレッドシート、プレゼンテーション、およびその他のデータ ファイルを編集するためのプラットフォームに依存しない API

デジタル ファイルを変更するコンテキストでのドキュメント編集とは、ドキュメント内のテキスト、画像、またはその他の要素を変更するプロセスを指します。データ ファイルのデジタル編集を使用して、コンテンツの正確性と明瞭性を向上させたり、既存のコンテンツに修正を加えたり、文書を読みやすくしたりすることができます。さまざまな種類のデジタル ドキュメントの使用がますます増えているため、それらを電子的に編集する必要性がますます重要になっています。

デジタル ドキュメントを電子的に編集する機能は、ドキュメントを扱うすべての人にとって不可欠なスキルになりました。 PDF、Microsoft Office、およびその他のデータ ファイルをすばやく正確に編集する方法を知っていると、時間を大幅に節約できます。この目的のために、PDF、Word、Excel、PowerPoint、OpenDocument、RTF、Text、HTML、eBooks など、.NET および Java プラットフォーム全体で多数の一般的なデータ ファイル形式の編集をサポートする GroupDocs.Editor API を使用できます。 .

入門

.NET または Java でドキュメントの編集を開始するには、まず必要なバージョンの GroupDocs.Editor をインストールする必要があります。 .NET または Java 用の GroupDocs.Editor を正しく設定するには、次のセクションで共有される手順を参照してください。

.NET インストール用の GroupDocs.Editor

ダウンロード セクションから DLL または MSI インストーラーを自由にダウンロードするか、NuGet を使用して API をインストールします。パッケージ マネージャー コンソールを使用することもできます。

PM> Install-Package GroupDocs.Editor 

インストールの詳細については、こちらのガイドをご確認ください。

Java インストール用の GroupDocs.Editor

Java バージョンの場合、ダウンロード セクションから JAR ファイルをダウンロードするか、リポジトリに次の構成を追加して、 (Maven ベースの) Java アプリでの依存関係:

<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 およびその他のデータ ファイルを編集するための使用例

.NET アプリで PDF ドキュメントを編集する方法を学ぶ

PDF 形式は、ドキュメント、レポート、およびその他のデジタル コンテンツに使用される一般的なファイル タイプです。 Portable Document Format の略で、共有しやすい高品質のドキュメントを作成できるため、広く使用されています。固定されたレイアウトを提供し、読み取りまたは表示しているデバイスやオペレーティング システムに関係なく、同じフォーマットとレイアウトを維持するため、他の一般的なデータ ファイル形式とは異なります。

しかし、PDF ドキュメントに変更を加える必要がある場合はどうすればよいでしょうか? PDF ファイルの編集はトリッキーなプロセスになる可能性がありますが、GroupDocs.Editor for .NET API を使用している場合はそうである必要はありません。この API を使用すると、他のドキュメントと同様に WYSIWYG エディターを使用して PDF ファイルを編集できます。現在、PDF 編集は GroupDocs.Editor API の .NET バージョンでのみサポートされており、Java バージョンではサポートされていません。

.NET アプリで PDF ドキュメントを編集する方法を学ぶ

.NET での PDF ドキュメントの編集

.NET で PDF ファイルを読み込み、編集、保存するには、次のコードを使用してください:

  //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 でこれらのドキュメント形式をプログラムで編集しようとしていますか?はいの場合、GroupDocs.Editor API を使用して Microsoft Word、Excel、および PowerPoint ドキュメントを編集できます。これを行うためにシステムに Microsoft Office をインストールする必要さえありません。

ワープロ ドキュメント、スプレッドシート、およびプレゼンテーションを .NET および Java で編集するにはどうすればよいですか?

.NET アプリで Word 文書を編集する

.NET で Word 文書 (DOCX) を編集するには、次のコードを使用してください:

    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);
                }
            }
        }
    }
} 

Java で Microsoft Word ファイルを変更する

Java で Word ドキュメントを編集するには、次のコードを使用してください:

    // 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); 

.NET での Excel スプレッドシートの編集

次の C# コードを使用して、.NET で Excel ドキュメントを編集できます。

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);
} 

Java で Microsoft Excel ドキュメントを編集する

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()

同様に、GroupDocs.Editor API を使用して PowerPoint プレゼンテーションも編集できます。 .NETJava 編集ガイドをご覧ください。

.NET および Java でテキスト ドキュメントを編集する方法と、独自のテキスト エディター アプリを作成する方法を学びます。

テキスト ファイル (TXT で示される) は、軽量でシンプルで、簡単に作成および共有できるため、最も一般的に使用されるファイル形式の 1 つです。これらは、コードの記述からプレーンなテキストのみのドキュメントの作成まで、さまざまな方法で使用されます。テキスト ドキュメントには、テキストの書式設定、画像、フォーム、テーブル、またはその他のリッチ テキスト要素は含まれません。

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); 

Java でのテキスト ドキュメント (TXT) の編集

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 API (.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(); 

無料のドキュメント編集アプリをお好きなデバイスでご利用いただけますので、お気軽にチェックしてください。

助けをお探しですか?

Conholdate 製品の API 機能と動作に関する質問については、サポート チャネルをチェックしてください。

始める準備はできましたか?

無料トライアルをダウンロード 価格情報