diff --git a/.github/workflows/editor-production.yml b/.github/workflows/editor-production.yml new file mode 100644 index 0000000..b9acb3d --- /dev/null +++ b/.github/workflows/editor-production.yml @@ -0,0 +1,69 @@ +# This is a basic workflow to help you get started with Actions + +name: tutorials.groupdocs.cloud(editor)(family)(Production) + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: [ master ] + paths: + - 'content/editor/**' + pull_request: + branches: [ master ] + paths: + - 'content/editor/**' + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of editor that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Checkout + uses: actions/checkout@v2 + with: + submodules: true # Fetch Hugo themes + fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod + - name: Checkout theme repo + uses: actions/checkout@main + with: + repository: groupdocs-cloud/tutorials-theme + token: ${{ secrets.REPO_TOKEN }} + fetch-depth: 0 + path: themes/tutorials-theme + # Step 2 - Sets up the latest version of Hugo + - name: Setup Hugo + uses: peaceiris/actions-hugo@v2 + with: + hugo-version: '0.135.0' + extended: true + - name: Install Dependicies1 + run: npm install -D --save autoprefixer + - name: Install Dependicies2 + run: npm install -D --save postcss-cli + # Also specifies the theme we want to use + - name: Build + run: hugo --configDir config/editor --environment production --minify + + - name: Deploy tutorials.groupdocs.cloud(editor)(family)(Production) to S3 + run: hugo --configDir config/editor --environment production deploy --target "Production" --maxDeletes 0 + env: + AWS_ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.SECRET_ACCESS }} + # Invalidate Cloudfront + - name: invalidate + uses: chetan/invalidate-cloudfront-action@v2 + env: + DISTRIBUTION: ${{ secrets.AWS_DISTRIBUTION_PROD }} + PATHS: /editor/* + AWS_REGION: 'us-west-2' + AWS_ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.SECRET_ACCESS }} diff --git a/.github/workflows/editor-staging.yml b/.github/workflows/editor-staging.yml new file mode 100644 index 0000000..5794dd6 --- /dev/null +++ b/.github/workflows/editor-staging.yml @@ -0,0 +1,69 @@ +# This is a basic workflow to help you get started with Actions + +name: qa-tutorials.groupdocs.cloud(editor)(family)(Stage) + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: [ staging ] + paths: + - 'content/editor/**' + pull_request: + branches: [ staging ] + paths: + - 'content/editor/**' + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of editor that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Checkout + uses: actions/checkout@v2 + with: + submodules: true # Fetch Hugo themes + fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod + - name: Checkout theme repo + uses: actions/checkout@main + with: + repository: groupdocs-cloud/tutorials-theme + token: ${{ secrets.REPO_TOKEN }} + fetch-depth: 0 + path: themes/tutorials-theme + # Step 2 - Sets up the latest version of Hugo + - name: Setup Hugo + uses: peaceiris/actions-hugo@v2 + with: + hugo-version: '0.135.0' + extended: true + - name: Install Dependicies1 + run: npm install -D --save autoprefixer + - name: Install Dependicies2 + run: npm install -D --save postcss-cli + # Also specifies the theme we want to use + - name: Build + run: hugo --configDir config/editor --environment staging --minify + + - name: Deploy qa-tutorials.groupdocs.cloud(editor)(family)(Stage) to S3 + run: hugo --configDir config/editor --environment staging deploy --target "Stage" --maxDeletes 0 + env: + AWS_ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.SECRET_ACCESS }} + # Invalidate Cloudfront + - name: invalidate + uses: chetan/invalidate-cloudfront-action@v2 + env: + DISTRIBUTION: ${{ secrets.AWS_DISTRIBUTION }} + PATHS: /editor/* + AWS_REGION: 'us-west-2' + AWS_ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.SECRET_ACCESS }} diff --git a/config/editor/_default/config.toml b/config/editor/_default/config.toml new file mode 100644 index 0000000..df1e179 --- /dev/null +++ b/config/editor/_default/config.toml @@ -0,0 +1,150 @@ +baseURL = "/editor" +title = "GroupDocs Cloud Tutorials" +staticdir = 'content/static' +enableRobotsTXT = true +enableGitInfo = true +disableKinds = ["taxonomy", "taxonomyTerm", "page", "RSS"] + +# Hugo allows theme composition (and inheritance). The precedence is from left to right. +theme = ["tutorials-theme"] + +[params.menu] +zh = "groupdocscloud-zh" +ru = "groupdocscloud-ru" +ar = "groupdocscloud-ar" +cs = "groupdocscloud-cs" +de = "groupdocscloud-de" +el = "groupdocscloud-el" +es = "groupdocscloud-es" +fr = "groupdocscloud-fr" +hi = "groupdocscloud-hi" +hu = "groupdocscloud-hu" +id = "groupdocscloud-id" +it = "groupdocscloud-it" +ja = "groupdocscloud-ja" +ko = "groupdocscloud-ko" +nl = "groupdocscloud-nl" +pl = "groupdocscloud-pl" +pt = "groupdocscloud-pt" +sv = "groupdocscloud-sv" +th = "groupdocscloud-th" +tr = "groupdocscloud-tr" +vi = "groupdocscloud-vi" +zh-hant = "groupdocscloud-zht" + +defaultContentLang = 'en' +[languages] + [languages.en] + contentDir = 'content/editor/english' + languageName = 'English' + languageCode = "en" + flag = "flag-us" + weight = 10 + +ignoreFiles = ["(?i:readme.md)", '\.spin$'] + +# Image processing configuration. +[imaging] +resampleFilter = "CatmullRom" +quality = 75 +anchor = "smart" + +[services] +[services.googleAnalytics] +# Comment out the next line to disable GA tracking. Also disables the feature described in [params.ui.feedback]. +# id = "UA-00000000-0" + +[markup] + [markup.tableOfContents] + endLevel = 2 + ordered = true + startLevel = 2 + [markup.goldmark] + [markup.goldmark.renderer] + unsafe = true + [markup.highlight] + anchorLineNos = false + codeFences = true + guessSyntax = false + hl_Lines = "" + lineAnchors = "" + lineNoStart = 1 + lineNos = false + lineNumbersInTable = true + noClasses = false + tabWidth = 4 + +# Everything below this are Site Params + +[params] +copyright = "The GroupDocs Cloud Authors" +privacy_policy = "https://policies.google.com/privacy" +topbar_search_active = false +logo_rel_link = "" + +# Containerize Menu +[params.containerize] +menu = "groupdocscloud-en" + +[params.meta] +msapplication_TileColor = "#2b5797" +msapplication_config = "https://cms.admin.containerize.com/templates/groupdocscloud/images/browserconfig.xml" +theme_color = "#ffffff" +author = "GroupDocs Cloud" + +# Title of 404 page +title_404_page = "404 - Page Not Found | GroupDocs Cloud Tutorials" + +# Open Grapgh settings +title = "GroupDocs Cloud Tutorials" +images = ["images/aspose-cloud-image-for-open-graph.jpg"] +description = "REST APIs along with open-source SDKs that allow developers to enhance applications with the capability to display, annotate, convert, e-sign, merge, classify, compare & translate documents in the Cloud" + + +# Set to true to disable breadcrumb navigation. +breadcrumb_disable = false +# Set to true to hide the sidebar search box (the top nav search box will still be displayed if search is enabled) +sidebar_search_disable = true +# Set to false if you don't want to display a logo (/assets/icons/logo.svg) in the top nav bar +navbar_logo = false +# Set to true to disable the About link in the site footer +footer_about_disable = false + + +[minify] + disableCSS = false + disableHTML = false + disableJS = false + disableJSON = false + disableSVG = false + disableXML = false + minifyOutput = true + [minify.tdewolff] + [minify.tdewolff.css] + decimals = -1 + keepCSS2 = true + [minify.tdewolff.html] + keepConditionalComments = true + keepDefaultAttrVals = true + keepDocumentTags = true + keepEndTags = true + keepQuotes = false + keepWhitespace = false + [minify.tdewolff.js] + [minify.tdewolff.json] + [minify.tdewolff.svg] + decimals = -1 + [minify.tdewolff.xml] + keepWhitespace = false + +[Taxonomies] + +[deployment] +[[deployment.matchers]] +# Set custom content type for /sitemap.xml +#pattern = "^sitemap\\.xml$" +#pattern = "^[a-z]\\.xml$" +pattern = "^.+\\.(xml)$" +contentType = "application/xml" +gzip = true +force = true diff --git a/config/editor/production/config.toml b/config/editor/production/config.toml new file mode 100644 index 0000000..cab7808 --- /dev/null +++ b/config/editor/production/config.toml @@ -0,0 +1,9 @@ +baseURL = "https://tutorials.groupdocs.cloud/editor" + +# Google Tag Manager settings +[params.gtm] +gtm_id = "GTM-T42TVBC" + +[[deployment.targets]] +name = "Production" +URL = "s3://tutorials.groupdocs.cloud/?prefix=editor/®ion=us-west-2" diff --git a/config/editor/staging/config.toml b/config/editor/staging/config.toml new file mode 100644 index 0000000..5b84b4d --- /dev/null +++ b/config/editor/staging/config.toml @@ -0,0 +1,8 @@ +baseURL = "https://qa-tutorials.groupdocs.cloud/editor" + +[[deployment.targets]] +name = "Stage" +URL = "s3://qa-tutorials.groupdocs.cloud/?prefix=editor /®ion=us-west-2" + + + diff --git a/content/editor/english/_index.md b/content/editor/english/_index.md new file mode 100644 index 0000000..fad8cbf --- /dev/null +++ b/content/editor/english/_index.md @@ -0,0 +1,82 @@ +--- +title: GroupDocs.Editor Cloud Tutorials - Comprehensive Documentation +url: /editor/ +weight: 2 +description: Complete tutorial for integrating and implementing GroupDocs.Editor Cloud API in your applications. Learn about authentication, document editing workflows, and advanced editing features. +--- + +# GroupDocs.Editor Cloud Tutorials + +Welcome to the comprehensive tutorial for GroupDocs.Editor Cloud. This guide provides detailed instructions and examples to help you integrate and implement document editing capabilities in your applications using our powerful cloud-based API. + +## Getting Started + +GroupDocs.Editor Cloud offers a robust, platform-independent document editing solution that enables you to edit documents in various formats without requiring additional software installations on the client side. + +### [Document Editing and Update Operations Tutorials](/editor/document-edit-operations/) + +Learn how to edit and update various document formats using GroupDocs.Editor Cloud API with these step-by-step tutorials. + +### [Document Storage Handling Procedures Tutorials](/editor/storage-handling-procedures/) + +Learn step-by-step how to manage document storage using GroupDocs.Editor Cloud API with these comprehensive developer tutorials. + +## Basic Workflow + +The typical workflow for editing documents with GroupDocs.Editor Cloud involves these steps: + +1. Upload your document to the cloud storage +2. Edit the document by loading it into the editor +3. Save the edited document back to cloud storage + +### Supported File Formats + +GroupDocs.Editor Cloud supports a wide range of document formats including: + +- Microsoft Word documents (DOC, DOCX) +- Microsoft Excel spreadsheets (XLS, XLSX) +- Microsoft PowerPoint presentations (PPT, PPTX) +- PDF documents +- Plain text and markup formats (TXT, HTML, XML) +- And many more + +## Advanced Features + +GroupDocs.Editor Cloud offers advanced editing capabilities: + +- Format-specific editing options: Configure editing options tailored to specific document formats +- HTML-based editing: Edit documents in HTML format for seamless integration with WYSIWYG editors +- Document protection: Add or maintain document protection during the editing process +- Responsive design: Edit documents on any device with responsive UI components +- Cross-platform compatibility: Work with documents across different operating systems and browsers + +## SDK Integration + +GroupDocs.Editor Cloud provides SDKs for various programming languages to simplify integration: + +- .NET +- Java +- PHP +- Python +- Ruby +- Node.js + +## Best Practices + +For optimal performance and user experience, consider these best practices: + +- Implement proper error handling for API responses +- Optimize document processing for large files +- Cache frequently accessed documents +- Implement user permissions for collaborative editing +- Regularly update your SDK to the latest version + +## Helpful Resources + +- [Product Page](https://products.groupdocs.cloud/editor/) +- [Documentation](https://docs.groupdocs.cloud/editor/) +- [Live Demo](https://products.groupdocs.app/editor/family) +- [API Reference](https://reference.groupdocs.cloud/editor/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.editor-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/editor/20/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) diff --git a/content/editor/english/document-edit-operations/_index.md b/content/editor/english/document-edit-operations/_index.md new file mode 100644 index 0000000..0399d34 --- /dev/null +++ b/content/editor/english/document-edit-operations/_index.md @@ -0,0 +1,44 @@ +--- +title: GroupDocs.Editor Cloud API Document Editing and Update Operations Tutorials +url: /document-edit-operations/ +weight: 1 +description: Learn how to edit and update various document formats using GroupDocs.Editor Cloud API with these step-by-step tutorials. +--- + +# Document Editing and Update Operations Tutorials + +Welcome to our hands-on tutorial series for developers learning to work with the GroupDocs.Editor Cloud API. These step-by-step guides will take you through the process of editing and updating various document formats in the cloud, from basic operations to advanced techniques. + +## Learning Path + +This tutorial series follows a progressive learning path designed to build your skills from fundamental concepts to more complex implementations: + +1. Beginner Level: Learn the basics of document loading and editing operations +2. Intermediate Level: Master specific document format handling and manipulation +3. Advanced Level: Implement complex workflows and integrations + +## Document Editing Tutorials + +### WordProcessing Document Tutorials +- [Tutorial: Working with WordProcessing Documents](/document-edit-operations/working-with-wordprocessing-documents/) - Learn how to load, edit, and save Word documents including DOC, DOCX, DOCM, and other formats. + +### Spreadsheet Document Tutorials +- [Tutorial: Working with Spreadsheet Documents](/document-edit-operations/working-with-spreadsheets/) - Discover how to edit Excel and other spreadsheet formats including XLS, XLSX, XLSM, and ODS. + +### Text Document Tutorials +- [Tutorial: Working with Text Documents](/document-edit-operations/working-with-text-documents/) - Learn techniques for editing plain text files and converting them to other formats. + +### DSV Document Tutorials +- [Tutorial: Working with DSV Documents](/document-edit-operations/working-with-dsv-documents/) - Hands-on guide to working with delimiter-separated values documents like CSV and TSV. + +## Resources + +To help you make the most of these tutorials, here are some additional resources: + +- [Product Page](https://products.groupdocs.cloud/editor/) +- [Documentation](https://docs.groupdocs.cloud/editor/) +- [Live Demo](https://products.groupdocs.app/editor/family) +- [API Reference](https://reference.groupdocs.cloud/editor/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.editor-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/editor/20/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) diff --git a/content/editor/english/document-edit-operations/working-with-dsv-documents/_index.md b/content/editor/english/document-edit-operations/working-with-dsv-documents/_index.md new file mode 100644 index 0000000..3316dd0 --- /dev/null +++ b/content/editor/english/document-edit-operations/working-with-dsv-documents/_index.md @@ -0,0 +1,332 @@ +--- +title: How to Edit DSV Documents with GroupDocs.Editor Cloud Tutorial +url: /document-edit-operations/working-with-dsv-documents/ +weight: 5 +description: Learn to edit CSV, TSV and other delimiter-separated values files in the cloud with this step-by-step tutorial using GroupDocs.Editor Cloud API. +--- + +# Tutorial: Working with DSV Documents + +## Learning Objectives + +In this tutorial, you'll learn how to: +- Load Delimiter-Separated Values (DSV) documents for editing +- Configure delimiter and data handling options +- Edit DSV content using HTML representation +- Save the edited content back to DSV or other formats +- Implement a complete DSV editing workflow + +## Prerequisites + +Before starting this tutorial, you should have: +- A [GroupDocs.Editor Cloud dashboard](https://dashboard.groupdocs.cloud/) account +- Your Client ID and Client Secret credentials +- Basic understanding of REST API concepts +- Familiarity with DSV file structure (CSV, TSV, etc.) +- Basic knowledge of your preferred programming language + +## Understanding DSV Documents + +Delimiter-Separated Values (DSV) documents are a specific form of text-based spreadsheets where values are separated by a delimiter character. Common formats include: + +- CSV (Comma-Separated Values) +- TSV (Tab-Separated Values) +- Other custom formats with different delimiters + +These files are widely used for data exchange between systems due to their simple structure. GroupDocs.Editor Cloud allows you to edit these files and provides options to handle different separator characters and data conversion settings. + +### Step 1: Upload Your DSV Document to Cloud Storage + +First, upload your DSV document to GroupDocs cloud storage. For details on storage operations, refer to the [Storage Operations Tutorial](/storage-handling-procedures/). + +### Step 2: Load the DSV Document for Editing + +To load a DSV document for editing, use the following API endpoint: + +``` +HTTP POST ~/load +``` + +When loading DSV documents, you can configure these specific options: + +| Option | Description | +|--------|-------------| +| FileInfo.FilePath | The file path in storage (required) | +| FileInfo.StorageName | Storage name (optional for default storage) | +| OutputPath | Directory where editable files will be stored | +| Separator | String separator (delimiter) for the document | +| ConvertDateTimeData | Whether to convert strings to date data (default: false) | +| ConvertNumericData | Whether to convert strings to numeric data (default: false) | +| TreatConsecutiveDelimitersAsOne | Whether consecutive delimiters should be treated as one (default: false) | + +#### Try It Yourself: Loading a DSV Document + +Let's load a CSV file for editing: + +#### cURL Example + +```bash +# First get JSON Web Token +curl -v "https://api.groupdocs.cloud/connect/token" \ +-X POST \ +-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET" \ +-H "Content-Type: application/x-www-form-urlencoded" \ +-H "Accept: application/json" + +# Now load the DSV document +curl -v "https://api.groupdocs.cloud/v1.0/editor/load" \ +-X POST \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +-d "{ + 'FileInfo': { 'FilePath': 'cells/sample.csv' }, + 'OutputPath': 'output', + 'Separator': ',', + 'ConvertNumericData': true +}" +``` + +Upon successful execution, you'll receive a response with paths to the generated HTML and resources: + +```json +{ + "resourcesPath": "output/sample.files", + "htmlPath": "output/sample.html" +} +``` + +#### SDK Example (Python) + +```python +# For complete examples and data files, please go to https://github.com/groupdocs-editor-cloud/groupdocs-editor-cloud-python-samples +import groupdocs_editor_cloud + +# Get your app_sid and app_key from https://dashboard.groupdocs.cloud +app_sid = "YOUR_CLIENT_ID" +app_key = "YOUR_CLIENT_SECRET" + +# Create instance of the API +api = groupdocs_editor_cloud.EditApi.from_keys(app_sid, app_key) + +# Prepare request +file_info = groupdocs_editor_cloud.FileInfo() +file_info.file_path = "cells/sample.csv" + +load_options = groupdocs_editor_cloud.LoadOptions() +load_options.file_info = file_info +load_options.output_path = "output" +load_options.separator = "," # Specify the delimiter +load_options.convert_numeric_data = True # Convert strings to numbers where possible + +# Execute request +result = api.load(groupdocs_editor_cloud.LoadRequest(load_options)) + +# Print the HTML path +print("HTML file path: " + result.html_path) +print("Resources path: " + result.resources_path) +``` + +### Step 3: Understanding DSV to HTML Conversion + +When a DSV document is loaded for editing, GroupDocs.Editor Cloud converts it to an HTML table representation: + +1. Each row in the DSV file becomes a row in the HTML table +2. Each field becomes a cell in the table +3. Data is converted according to settings (numeric/date conversion) +4. The first row is often treated as a header row + +#### Learning Checkpoint: HTML Structure + +Let's examine a sample CSV content and its HTML representation: + +Original CSV: +``` +Name,Age,Department,Salary +John Smith,35,Marketing,65000 +Jane Doe,42,Engineering,85000 +Mike Johnson,28,Sales,55000 +``` + +Converted HTML Structure: +```html + + + + + + + + + + + + + + + + + + +
NameAgeDepartmentSalary
John Smith35Marketing65000
+``` + +Notice how the CSV data is properly structured into an HTML table with headers and data cells. + +### Step 4: Editing DSV Content + +After downloading the HTML file, you can edit it using your preferred HTML editor or programmatically: + +1. Modify cell values +2. Add or remove rows and columns +3. Apply formatting (which will be stripped when saving back to DSV) +4. Sort or reorganize data + +When editing, remember that the table structure must be maintained for proper conversion back to DSV format. + +### Step 5: Save the Edited Document + +After editing, upload the HTML file back to storage and use the save operation to convert it back to DSV format: + +``` +HTTP POST ~/save +``` + +Key options for saving DSV documents include: + +| Option | Description | +|--------|-------------| +| FileInfo.FilePath | The output file path in storage | +| FileInfo.StorageName | Storage name (optional for default storage) | +| HtmlPath | The path to the edited HTML file | +| ResourcesPath | The path to the resources folder | +| OutputFormat | Output format specification | + +#### Try It Yourself: Saving an Edited DSV Document + +#### cURL Example + +```bash +# Save the edited document +curl -v "https://api.groupdocs.cloud/v1.0/editor/save" \ +-X POST \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +-d "{ + 'FileInfo': { 'FilePath': 'cells/edited-sample.csv' }, + 'HtmlPath': 'output/sample.html', + 'ResourcesPath': 'output/sample.files' +}" +``` + +#### SDK Example (Java) + +```java +// For complete examples and data files, please go to https://github.com/groupdocs-editor-cloud/groupdocs-editor-cloud-java-samples +import com.groupdocs.cloud.editor.client.*; +import com.groupdocs.cloud.editor.model.*; +import com.groupdocs.cloud.editor.api.EditApi; + +public class EditDsvDocument { + public static void main(String[] args) { + // Get your client ID and client secret from https://dashboard.groupdocs.cloud + String clientId = "YOUR_CLIENT_ID"; + String clientSecret = "YOUR_CLIENT_SECRET"; + + // Create instance of the API + Configuration configuration = new Configuration(clientId, clientSecret); + EditApi apiInstance = new EditApi(configuration); + + try { + // Prepare save options + FileInfo fileInfo = new FileInfo(); + fileInfo.setFilePath("cells/edited-sample.csv"); + + SaveOptions saveOptions = new SaveOptions(); + saveOptions.setFileInfo(fileInfo); + saveOptions.setHtmlPath("output/sample.html"); + saveOptions.setResourcesPath("output/sample.files"); + + // Execute save request + SaveResult response = apiInstance.save(new SaveRequest(saveOptions)); + + // Print the result + System.out.println("Document saved successfully to: " + fileInfo.getFilePath()); + } catch (ApiException e) { + System.err.println("Exception when calling EditApi: " + e.getMessage()); + e.printStackTrace(); + } + } +} +``` + +## Practical Example: Working with Sales Data + +Let's work through a complete example of updating a sales data CSV file: + +### Scenario: Update Monthly Sales Report + +Imagine you have a CSV file containing monthly sales data that needs updating: + +1. Upload the file: Upload "MonthlySales.csv" to cloud storage +2. Load for editing: + - Specify comma as the separator + - Enable numeric data conversion + - Enable date/time data conversion +3. Edit content: + - Update sales figures for the current month + - Add new product rows + - Correct errors in existing data +4. Save the changes: Convert back to CSV format + +This workflow demonstrates a practical application for updating tabular data stored in DSV format. + +### Special Considerations for Different DSV Types + +Different DSV formats may require specific handling: + +- CSV (comma-separated): Most common format, typically uses `,` as separator +- TSV (tab-separated): Uses tab character `\t` as separator +- Custom formats: May use other characters like `;` or `|` + +When working with these formats, be sure to specify the correct separator character in the load options. + +## Troubleshooting Tips + +- Delimiter Issues: If fields contain the delimiter character, ensure they're properly quoted in the original file +- Data Type Conversion: If numeric or date conversion produces unexpected results, try disabling these options +- Consecutive Delimiters: For data with empty fields, the `TreatConsecutiveDelimitersAsOne` option affects how they're processed +- Table Structure: When editing, maintain the HTML table structure to ensure proper conversion back to DSV + +## What You've Learned + +In this tutorial, you've learned how to: +- Load DSV documents into editable HTML format +- Configure delimiter and data conversion settings +- Edit tabular data in HTML format +- Save edited content back to DSV format +- Use both REST API calls and SDK methods to implement the editing workflow + +## Further Practice + +To reinforce your learning, try these exercises: +1. Create a script that converts between different DSV formats (e.g., CSV to TSV) +2. Build a web application that allows users to edit and visualize DSV data +3. Implement a data cleaning workflow for a CSV file with inconsistent formatting +4. Create a batch processor that updates multiple DSV files with new data + +## Next Steps + +Ready to learn more? Continue your journey with these related tutorials: +- [Tutorial: Working with Spreadsheet Documents](/document-edit-operations/working-with-spreadsheets/) + +## Resources + +- [Product Page](https://products.groupdocs.cloud/editor/) +- [Documentation](https://docs.groupdocs.cloud/editor/) +- [Live Demo](https://products.groupdocs.app/editor/family) +- [API Reference](https://reference.groupdocs.cloud/editor/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.editor-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/editor/20/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) diff --git a/content/editor/english/document-edit-operations/working-with-spreadsheets/_index.md b/content/editor/english/document-edit-operations/working-with-spreadsheets/_index.md new file mode 100644 index 0000000..a41e4e6 --- /dev/null +++ b/content/editor/english/document-edit-operations/working-with-spreadsheets/_index.md @@ -0,0 +1,276 @@ +--- +title: How to Edit Spreadsheet Documents with GroupDocs.Editor Cloud Tutorial +url: /document-edit-operations/working-with-spreadsheets/ +weight: 2 +description: This tutorial guides you through editing Excel and other spreadsheet formats in the cloud with step-by-step instructions using GroupDocs.Editor API. +--- + +# Tutorial: Working with Spreadsheet Documents + +## Learning Objectives + +In this tutorial, you'll learn how to: +- Load spreadsheet documents (XLS, XLSX, XLSM, etc.) into editable HTML format +- Configure worksheet-specific options during loading +- Edit spreadsheet content in HTML format +- Save the edited content back to spreadsheet format +- Implement the complete edit workflow using different programming languages + +## Prerequisites + +Before starting this tutorial, you should have: +- A [GroupDocs.Editor Cloud dashboard](https://dashboard.groupdocs.cloud/) account +- Your Client ID and Client Secret credentials +- Basic understanding of REST API concepts +- Familiarity with spreadsheet structure and editing +- Basic knowledge of your preferred programming language + +## The Spreadsheet Editing Process + +GroupDocs.Editor Cloud supports various spreadsheet formats including XLS, XLSX, XLSM, XLSB, ODS, SXC, and others. The editing process follows a structured workflow: + +### Step 1: Upload Your Spreadsheet to Cloud Storage + +First, upload your spreadsheet document to GroupDocs cloud storage. For details on storage operations, refer to the [Storage Operations Tutorial](/storage-operations). + +### Step 2: Load the Spreadsheet for Editing + +To load a spreadsheet document for editing, use the following API endpoint: + +``` +HTTP POST ~/load +``` + +When loading spreadsheet documents, you can configure these specific options: + +| Option | Description | +|--------|-------------| +| FileInfo.FilePath | The file path in storage (required) | +| FileInfo.StorageName | Storage name (optional for default storage) | +| FileInfo.Password | Password for protected documents | +| OutputPath | Directory where editable files will be stored | +| WorksheetIndex | 0-based index of the worksheet to edit (required) | +| ExcludeHiddenWorksheets | Whether to exclude hidden worksheets (default: false) | + +#### Try It Yourself: Loading a Spreadsheet + +Let's see how to load an Excel file for editing: + +#### cURL Example + +```bash +# First get JSON Web Token +curl -v "https://api.groupdocs.cloud/connect/token" \ +-X POST \ +-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET" \ +-H "Content-Type: application/x-www-form-urlencoded" \ +-H "Accept: application/json" + +# Now load the spreadsheet +curl -v "https://api.groupdocs.cloud/v1.0/editor/load" \ +-X POST \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +-d "{ + 'FileInfo': { 'FilePath': 'Spreadsheet/sample.xlsx' }, + 'OutputPath': 'output', + 'WorksheetIndex': 0 +}" +``` + +Upon successful execution, you'll receive a response with paths to the generated HTML and resources: + +```json +{ + "resourcesPath": "output/sample.files", + "htmlPath": "output/sample.html" +} +``` + +#### SDK Example (Python) + +```python +# For complete examples and data files, please go to https://github.com/groupdocs-editor-cloud/groupdocs-editor-cloud-python-samples +import groupdocs_editor_cloud + +# Get your app_sid and app_key from https://dashboard.groupdocs.cloud +app_sid = "YOUR_CLIENT_ID" +app_key = "YOUR_CLIENT_SECRET" + +# Create instance of the API +api = groupdocs_editor_cloud.EditApi.from_keys(app_sid, app_key) + +# Prepare request +file_info = groupdocs_editor_cloud.FileInfo() +file_info.file_path = "Spreadsheet/sample.xlsx" + +load_options = groupdocs_editor_cloud.LoadOptions() +load_options.file_info = file_info +load_options.output_path = "output" +load_options.worksheet_index = 0 # Specify which worksheet to edit + +# Execute request +result = api.load(groupdocs_editor_cloud.LoadRequest(load_options)) + +# Print the HTML path +print("HTML file path: " + result.html_path) +print("Resources path: " + result.resources_path) +``` + +### Step 3: Understanding the Output Structure + +When a spreadsheet is loaded for editing, GroupDocs.Editor Cloud generates: + +1. An HTML file containing the worksheet content +2. A resources folder containing styles and other dependencies + +The HTML representation maintains the structure of the worksheet, including: +- Cell values and formatting +- Row and column structures +- Basic styles and colors + +#### Learning Checkpoint: HTML Structure + +Take a moment to examine the generated HTML file. Notice how: +- Table elements are used to represent the grid structure +- Cell styles preserve the original formatting +- Cell content maintains data types (text, numbers, dates) + +### Step 4: Edit the HTML Content + +After downloading the HTML file, you can edit it according to your requirements: +1. Modify cell values +2. Change formatting +3. Add or remove rows/columns +4. Update formulas + +Remember that editing is performed on the client side, using your preferred HTML editor or programmatically. + +### Step 5: Save the Edited Spreadsheet + +After editing, upload the HTML file back to storage and use the save operation to convert it back to spreadsheet format: + +``` +HTTP POST ~/save +``` + +Key options for saving spreadsheets include: + +| Option | Description | +|--------|-------------| +| FileInfo.FilePath | The output file path in storage | +| FileInfo.StorageName | Storage name (optional for default storage) | +| FileInfo.Password | Password for protected documents | +| HtmlPath | The path to the edited HTML file | +| ResourcesPath | The path to the resources folder | +| Options | Format-specific save options | + +#### Try It Yourself: Saving an Edited Spreadsheet + +#### cURL Example + +```bash +# Save the edited spreadsheet +curl -v "https://api.groupdocs.cloud/v1.0/editor/save" \ +-X POST \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +-d "{ + 'FileInfo': { 'FilePath': 'Spreadsheet/edited-sample.xlsx' }, + 'HtmlPath': 'output/sample.html', + 'ResourcesPath': 'output/sample.files' +}" +``` + +#### SDK Example (Java) + +```java +// For complete examples and data files, please go to https://github.com/groupdocs-editor-cloud/groupdocs-editor-cloud-java-samples +import com.groupdocs.cloud.editor.client.*; +import com.groupdocs.cloud.editor.model.*; +import com.groupdocs.cloud.editor.api.EditApi; + +public class EditSpreadsheet { + public static void main(String[] args) { + // Get your client ID and client secret from https://dashboard.groupdocs.cloud + String clientId = "YOUR_CLIENT_ID"; + String clientSecret = "YOUR_CLIENT_SECRET"; + + // Create instance of the API + Configuration configuration = new Configuration(clientId, clientSecret); + EditApi apiInstance = new EditApi(configuration); + + try { + // Prepare save options + FileInfo fileInfo = new FileInfo(); + fileInfo.setFilePath("Spreadsheet/edited-sample.xlsx"); + + SaveOptions saveOptions = new SaveOptions(); + saveOptions.setFileInfo(fileInfo); + saveOptions.setHtmlPath("output/sample.html"); + saveOptions.setResourcesPath("output/sample.files"); + + // Execute save request + SaveResult response = apiInstance.save(new SaveRequest(saveOptions)); + + // Print the result + System.out.println("Document saved successfully to: " + fileInfo.getFilePath()); + } catch (ApiException e) { + System.err.println("Exception when calling EditApi: " + e.getMessage()); + e.printStackTrace(); + } + } +} +``` + +## Practical Example: Editing a Financial Report + +Let's work through a complete example of editing a quarterly financial report in Excel format: + +1. Upload the document: Upload "FinancialReport.xlsx" to cloud storage +2. Load for editing: Convert the first worksheet (index 0) to HTML +3. Edit content: Update the Q3 revenue figures and fix formula calculations +4. Save the changes: Convert back to XLSX format with a new filename + +This workflow demonstrates a practical application of the GroupDocs.Editor Cloud API for real-world spreadsheet editing. + +## Troubleshooting Tips + +- Wrong Worksheet Index: If you receive an error, verify that the worksheet index exists in your document +- Formula Issues: When editing, be careful not to break Excel formulas; the HTML representation preserves them +- Hidden Worksheets: If you need to access hidden worksheets, set `ExcludeHiddenWorksheets` to false +- Large Files: For very large spreadsheets, consider editing one worksheet at a time + +## What You've Learned + +In this tutorial, you've learned how to: +- Load spreadsheet documents into editable HTML format +- Work with specific worksheets in multi-sheet documents +- Edit spreadsheet content in HTML format +- Save edited content back to its original format +- Use both REST API calls and SDK methods to implement the editing workflow + +## Further Practice + +To reinforce your learning, try these exercises: +1. Edit a spreadsheet with multiple worksheets, loading each worksheet separately +2. Create a simple web application that allows users to edit cell values and formulas +3. Implement a batch processing system to update multiple spreadsheets + +## Next Steps + +Ready to learn more? Continue your journey with these related tutorials: +- [Tutorial: Working with DSV Documents](/document-edit-operations/working-with-dsv-documents/) +- [Tutorial: Working with Text Documents](/document-edit-operations/working-with-text-documents/) + +## Resources + +- [Product Page](https://products.groupdocs.cloud/editor/) +- [Documentation](https://docs.groupdocs.cloud/editor/) +- [Live Demo](https://products.groupdocs.app/editor/family) +- [API Reference](https://reference.groupdocs.cloud/editor/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.editor-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/editor/20/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) diff --git a/content/editor/english/document-edit-operations/working-with-text-documents/_index.md b/content/editor/english/document-edit-operations/working-with-text-documents/_index.md new file mode 100644 index 0000000..8d7cf62 --- /dev/null +++ b/content/editor/english/document-edit-operations/working-with-text-documents/_index.md @@ -0,0 +1,316 @@ +--- +title: How to Edit Text Documents with GroupDocs.Editor Cloud Tutorial +url: /document-edit-operations/working-with-text-documents/ +weight: 4 +description: This step-by-step tutorial teaches you how to edit plain text files using GroupDocs.Editor Cloud API with options to convert to other formats. +--- + +# Tutorial: Working with Text Documents + +## Learning Objectives + +In this tutorial, you'll learn how to: +- Load plain text (TXT) documents for editing +- Configure special handling for leading and trailing spaces +- Edit text content in HTML format +- Convert edited text documents to WordProcessing formats +- Implement a complete text editing workflow + +## Prerequisites + +Before starting this tutorial, you should have: +- A [GroupDocs.Editor Cloud dashboard](https://dashboard.groupdocs.cloud/) account +- Your Client ID and Client Secret credentials +- Basic understanding of REST API concepts +- Familiarity with text file structure +- Basic knowledge of your preferred programming language + +## Understanding Text Documents + +Plain Text (TXT) files are the simplest document format containing only unformatted text without embedded images, pages, or complex formatting. However, you can create simple formatting using: +- Lists with leading markers +- Indentation with whitespace +- Tables with pseudo-graphics +- Paragraphs with line breaks + +GroupDocs.Editor Cloud can recognize some of these structures and also offers the unique ability to save edited text documents not only back to TXT but also to WordProcessing formats. + +### Step 1: Load the Text Document for Editing + +To load a text document for editing, use the following API endpoint: + +``` +HTTP POST ~/load +``` + +When loading text documents, you can configure these specific options: + +| Option | Description | +|--------|-------------| +| FileInfo.FilePath | The file path in storage (required) | +| FileInfo.StorageName | Storage name (optional for default storage) | +| OutputPath | Directory where editable files will be stored | +| LeadingSpaces | How to handle leading spaces (default: convert to left indent) | +| TrailingSpaces | How to handle trailing spaces (default: truncate all trailing spaces) | +| EnablePagination | Enable/disable pagination in HTML (default: false) | + +#### Try It Yourself: Loading a Text Document + +Let's load a text file for editing: + +#### cURL Example + +```bash +# First get JSON Web Token +curl -v "https://api.groupdocs.cloud/connect/token" \ +-X POST \ +-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET" \ +-H "Content-Type: application/x-www-form-urlencoded" \ +-H "Accept: application/json" + +# Now load the text document +curl -v "https://api.groupdocs.cloud/v1.0/editor/load" \ +-X POST \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +-d "{ + 'FileInfo': { 'FilePath': 'Text/sample.txt' }, + 'OutputPath': 'output', + 'EnablePagination': true +}" +``` + +Upon successful execution, you'll receive a response with paths to the generated HTML and resources: + +```json +{ + "resourcesPath": "output/sample.files", + "htmlPath": "output/sample.html" +} +``` + +#### SDK Example (Ruby) + +```ruby +# For complete examples and data files, please go to https://github.com/groupdocs-editor-cloud/groupdocs-editor-cloud-ruby-samples +require 'groupdocs_editor_cloud' + +# Get your client ID and client secret from https://dashboard.groupdocs.cloud +client_id = "YOUR_CLIENT_ID" +client_secret = "YOUR_CLIENT_SECRET" + +# Create instance of the API +api = GroupDocsEditorCloud::EditApi.from_keys(client_id, client_secret) + +# Prepare request +file_info = GroupDocsEditorCloud::FileInfo.new +file_info.file_path = "Text/sample.txt" + +load_options = GroupDocsEditorCloud::LoadOptions.new +load_options.file_info = file_info +load_options.output_path = "output" +load_options.enable_pagination = true + +# Execute request +result = api.load(GroupDocsEditorCloud::LoadRequest.new(load_options)) + +# Print the result +puts "HTML file path: #{result.html_path}" +puts "Resources path: #{result.resources_path}" +``` + +### Step 2: Understanding Text Document Conversion to HTML + +When a text document is loaded for editing, GroupDocs.Editor Cloud: + +1. Analyzes the text structure to identify potential formatting (lists, paragraphs, etc.) +2. Converts the content to HTML with appropriate structure +3. Applies formatting based on the identified structures +4. Handles spaces according to the specified options + +#### Learning Checkpoint: HTML Structure + +Let's examine a sample text document and its HTML representation: + +Original Text: +``` +Company Report +-------------- + * First quarter results + * Second quarter forecast + * Sales projection + * Expense estimates +``` + +Converted HTML Structure: +```html +

Company Report

+
+ +``` + +Notice how GroupDocs.Editor Cloud has recognized: +- The heading structure +- The horizontal rule (dashes) +- The nested bullet list structure +- Indentation levels + +### Step 3: Edit the Text Content + +After downloading the HTML file, you can edit it according to your requirements: +1. Update text content +2. Modify the recognized structure +3. Add new elements +4. Format content with HTML tags + +The editing is done on the client side using your preferred HTML editor or programmatically. + +### Step 4: Save the Edited Document + +After editing, upload the HTML file back to storage and use the save operation to convert it back to text format or to a WordProcessing format: + +``` +HTTP POST ~/save +``` + +Key options for saving text documents include: + +| Option | Description | +|--------|-------------| +| FileInfo.FilePath | The output file path in storage | +| FileInfo.StorageName | Storage name (optional for default storage) | +| HtmlPath | The path to the edited HTML file | +| ResourcesPath | The path to the resources folder | +| Format | Output format (e.g., "txt" or "docx") | + +#### Try It Yourself: Saving an Edited Text Document + +#### cURL Example (Save as TXT) + +```bash +# Save the edited document as TXT +curl -v "https://api.groupdocs.cloud/v1.0/editor/save" \ +-X POST \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +-d "{ + 'FileInfo': { 'FilePath': 'Text/edited-sample.txt' }, + 'HtmlPath': 'output/sample.html', + 'ResourcesPath': 'output/sample.files' +}" +``` + +#### cURL Example (Save as DOCX) + +```bash +# Save the edited document as DOCX +curl -v "https://api.groupdocs.cloud/v1.0/editor/save" \ +-X POST \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +-d "{ + 'FileInfo': { 'FilePath': 'Text/edited-sample.docx' }, + 'HtmlPath': 'output/sample.html', + 'ResourcesPath': 'output/sample.files', + 'Format': 'docx' +}" +``` + +#### SDK Example (C#) + +```csharp +// For complete examples and data files, please go to https://github.com/groupdocs-editor-cloud/groupdocs-editor-cloud-dotnet-samples +string MyClientSecret = ""; // Get Client Id and Client Secret from https://dashboard.groupdocs.cloud +string MyClientId = ""; // Get Client Id and Client Secret from https://dashboard.groupdocs.cloud + +var configuration = new Configuration(MyClientId, MyClientSecret); +var apiInstance = new EditApi(configuration); + +// Prepare save options (save as DOCX) +var saveOptions = new SaveOptions +{ + FileInfo = new FileInfo + { + FilePath = "Text/edited-sample.docx" + }, + HtmlPath = "output/sample.html", + ResourcesPath = "output/sample.files", + Format = "docx" +}; + +// Execute save request +var response = apiInstance.Save(new SaveRequest(saveOptions)); + +// The edited document is now saved to the specified path +Console.WriteLine("Document saved successfully to: " + saveOptions.FileInfo.FilePath); +``` + +## Practical Example: Converting a Text-Based Report to Word + +Let's work through a complete example of converting a text-based report to a formatted Word document: + +### Scenario: Enhance a Legacy Text Report + +Imagine you have a legacy system that generates monthly reports in plain text format. You need to convert these reports to Word format with proper formatting: + +1. Upload the text report: Upload "MonthlyReport.txt" to cloud storage +2. Load for editing: Convert to HTML with pagination enabled +3. Enhance formatting: + - Add proper headings and styles + - Convert asterisk lists to proper bullet lists + - Add tables for data sections + - Add a company logo (through HTML) +4. Save as DOCX: Convert to Word format for better distribution + +This workflow demonstrates how to enhance a plain text document by leveraging GroupDocs.Editor Cloud's capabilities. + +## Troubleshooting Tips + +- Space Handling: If your text relies on specific spacing, experiment with the LeadingSpaces and TrailingSpaces options +- Structure Recognition: For complex text structures, you might need to manually adjust the HTML representation +- Format Conversion: When converting to Word formats, verify that all structures were properly translated +- HTML Validation: Ensure your edited HTML is well-formed to avoid issues during saving + +## What You've Learned + +In this tutorial, you've learned how to: +- Load text documents into editable HTML format +- Configure special handling for spaces and pagination +- Edit text content and enhance formatting in HTML +- Save edited content back to text format or convert to Word format +- Use both REST API calls and SDK methods to implement the editing workflow + +## Further Practice + +To reinforce your learning, try these exercises: +1. Convert a text file with pseudo-tables (using characters like +, -, |) to a Word document with proper tables +2. Create a script that batch-processes multiple text files to format them as Word documents +3. Build a simple web interface that allows users to upload text files and enhance their formatting + +## Next Steps + +Ready to learn more? Continue your journey with these related tutorials: +- [Tutorial: Working with DSV Documents](/document-edit-operations/working-with-dsv-documents/) +- [Tutorial: Working with WordProcessing Documents](/document-edit-operations/working-with-wordprocessing-documents/) +- [Tutorial: Working with Spreadsheet Documents](/document-edit-operations/working-with-spreadsheets/) + +## Resources + +- [Product Page](https://products.groupdocs.cloud/editor/) +- [Documentation](https://docs.groupdocs.cloud/editor/) +- [Live Demo](https://products.groupdocs.app/editor/family) +- [API Reference](https://reference.groupdocs.cloud/editor/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.editor-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/editor/20/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) diff --git a/content/editor/english/document-edit-operations/working-with-wordprocessing-documents/_index.md b/content/editor/english/document-edit-operations/working-with-wordprocessing-documents/_index.md new file mode 100644 index 0000000..bffa70e --- /dev/null +++ b/content/editor/english/document-edit-operations/working-with-wordprocessing-documents/_index.md @@ -0,0 +1,234 @@ +--- +title: Learn to Edit WordProcessing Documents with GroupDocs.Editor Cloud Tutorial +url: /document-edit-operations/working-with-wordprocessing-documents/ +weight: 1 +description: This tutorial teaches you how to load, edit and save Word documents using GroupDocs.Editor Cloud API in a step-by-step approach. +--- + +# Tutorial: Working with WordProcessing Documents + +## Learning Objectives + +In this tutorial, you'll learn how to: +- Load WordProcessing documents (DOC, DOCX, DOCM, etc.) from cloud storage +- Convert them to an editable HTML representation +- Download and edit the HTML content +- Upload the edited content back to cloud storage +- Save the edited document back to its original format + +## Prerequisites + +Before starting this tutorial, you should have: +- A [GroupDocs.Editor Cloud dashboard](https://dashboard.groupdocs.cloud/) account +- Your Client ID and Client Secret credentials +- Basic understanding of REST API concepts +- Familiarity with your preferred programming language (C#, Java, PHP, etc.) + +## The WordProcessing Document Editing Process + +WordProcessing document formats include DOC, DOT, DOCX, DOCM, DOTX, ODT, RTF, and more. GroupDocs.Editor Cloud supports all these formats as part of its document editing functionality. + +### Step 1: Load the Document for Editing + +The first step in editing is to load the document into an editable HTML representation: + +``` +HTTP POST ~/load +``` + +This operation converts your document to HTML and stores it in the cloud storage. You can customize several options: + +| Option | Description | +|--------|-------------| +| FileInfo.FilePath | The file path in storage (required) | +| FileInfo.StorageName | Storage name (optional for default storage) | +| FileInfo.Password | Password for protected documents | +| OutputPath | Directory where editable files will be stored | +| EnablePagination | Enable/disable pagination in HTML (default: false) | +| EnableLanguageInformation | Export language information to HTML (default: false) | +| FontExtraction | Control how fonts are extracted from the document | + +#### Try It Yourself: Loading a Document + +Let's see how to load a DOCX file using both cURL and SDK examples: + +#### cURL Example + +```bash +# First get JSON Web Token +curl -v "https://api.groupdocs.cloud/connect/token" \ +-X POST \ +-d "grant_type=client_credentials&client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET" \ +-H "Content-Type: application/x-www-form-urlencoded" \ +-H "Accept: application/json" + +# Now load the document +curl -v "https://api.groupdocs.cloud/v1.0/editor/load" \ +-X POST \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +-d "{ + 'FileInfo': { 'FilePath': 'WordProcessing/sample.docx' }, + 'OutputPath': 'output', + 'EnablePagination': true, + 'FontExtraction': 'ExtractAllEmbedded' +}" +``` + +Upon successful execution, you'll receive a response like: + +```json +{ + "resourcesPath": "output/sample.files", + "htmlPath": "output/sample.html" +} +``` + +#### SDK Example (C#) + +```csharp +// For complete examples and data files, please go to https://github.com/groupdocs-editor-cloud/groupdocs-editor-cloud-dotnet-samples +string MyClientSecret = ""; // Get Client Id and Client Secret from https://dashboard.groupdocs.cloud +string MyClientId = ""; // Get Client Id and Client Secret from https://dashboard.groupdocs.cloud + +var configuration = new Configuration(MyClientId, MyClientSecret); +var apiInstance = new EditApi(configuration); + +// Prepare request +var fileInfo = new FileInfo +{ + FilePath = "WordProcessing/sample.docx" +}; + +var loadOptions = new LoadOptions +{ + FileInfo = fileInfo, + OutputPath = "output", + EnablePagination = true, + FontExtraction = LoadOptions.FontExtractionEnum.ExtractAllEmbedded +}; + +// Execute request +var response = apiInstance.Load(new LoadRequest(loadOptions)); + +// The HTML representation is now available at the path in the response +Console.WriteLine("HTML file path: " + response.HtmlPath); +Console.WriteLine("Resources path: " + response.ResourcesPath); +``` + +### Step 2: Download and Edit the HTML Content + +Now that your document is converted to HTML, you can download it and make your edits. The HTML file and its associated resources need to be downloaded from the paths provided in the response: + +1. Download the HTML file from the path specified in `htmlPath` +2. Download the resources (if needed) from the path specified in `resourcesPath` +3. Edit the HTML using your preferred HTML editor or programmatically + +### Step 3: Upload the Edited HTML Back to Storage + +After editing, you need to upload the modified HTML content back to the cloud storage. + +### Step 4: Save the Edited Document + +Finally, you can save the edited HTML back to its original format using the save operation: + +``` +HTTP POST ~/save +``` + +This operation allows you to specify the following options: + +| Option | Description | +|--------|-------------| +| FileInfo.FilePath | The output file path in storage | +| FileInfo.StorageName | Storage name (optional for default storage) | +| FileInfo.Password | Password for protected documents | +| HtmlPath | The path to the edited HTML file | +| ResourcesPath | The path to the resources folder | +| Options | Format-specific save options | + +#### Try It Yourself: Saving an Edited Document + +#### cURL Example + +```bash +# Save the edited document +curl -v "https://api.groupdocs.cloud/v1.0/editor/save" \ +-X POST \ +-H "Content-Type: application/json" \ +-H "Accept: application/json" \ +-H "Authorization: Bearer YOUR_JWT_TOKEN" \ +-d "{ + 'FileInfo': { 'FilePath': 'WordProcessing/edited-sample.docx' }, + 'HtmlPath': 'output/sample.html', + 'ResourcesPath': 'output/sample.files' +}" +``` + +#### SDK Example (C#) + +```csharp +// For complete examples and data files, please go to https://github.com/groupdocs-editor-cloud/groupdocs-editor-cloud-dotnet-samples +string MyClientSecret = ""; // Get Client Id and Client Secret from https://dashboard.groupdocs.cloud +string MyClientId = ""; // Get Client Id and Client Secret from https://dashboard.groupdocs.cloud + +var configuration = new Configuration(MyClientId, MyClientSecret); +var apiInstance = new EditApi(configuration); + +// Prepare save options +var saveOptions = new SaveOptions +{ + FileInfo = new FileInfo + { + FilePath = "WordProcessing/edited-sample.docx" + }, + HtmlPath = "output/sample.html", + ResourcesPath = "output/sample.files" +}; + +// Execute save request +var response = apiInstance.Save(new SaveRequest(saveOptions)); + +// The edited document is now saved to the specified path +Console.WriteLine("Document saved successfully to: " + saveOptions.FileInfo.FilePath); +``` + +## Troubleshooting Tips + +- Authentication Error: Ensure your Client ID and Client Secret are correct and that your token hasn't expired +- File Not Found: Double-check that the file path is correct and the file exists in the specified storage +- HTML Conversion Issues: For complex documents, check the FontExtraction option to ensure fonts are properly handled +- Resource Loading Errors: Make sure all resource paths are correctly specified when saving + +## What You've Learned + +In this tutorial, you've learned how to: +- Load a WordProcessing document into an editable HTML representation +- Configure various loading options to control the conversion process +- Access and modify the HTML content +- Save the edited document back to its original format +- Use both REST API calls and SDK methods to perform these operations + +## Further Practice + +To reinforce your learning, try these exercises: +1. Load a document with pagination enabled and examine the resulting HTML structure +2. Experiment with different font extraction options and observe the differences +3. Create a simple web application that allows users to upload, edit, and download WordProcessing documents + +## Next Steps + +Ready to learn more? Continue your journey with these related tutorials: +- [Tutorial: Working with Spreadsheet Documents](/document-edit-operations/working-with-spreadsheets/) +- [Tutorial: Working with Text Documents](/document-edit-operations/working-with-text-documents/) + +## Resources + +- [Product Page](https://products.groupdocs.cloud/editor/) +- [Documentation](https://docs.groupdocs.cloud/editor/) +- [Live Demo](https://products.groupdocs.app/editor/family) +- [API Reference](https://reference.groupdocs.cloud/editor/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.editor-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/editor/20/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) diff --git a/content/editor/english/storage-handling-procedures/_index.md b/content/editor/english/storage-handling-procedures/_index.md new file mode 100644 index 0000000..46791d9 --- /dev/null +++ b/content/editor/english/storage-handling-procedures/_index.md @@ -0,0 +1,53 @@ +--- +title: GroupDocs.Editor Cloud API Document Storage Handling Procedures Tutorials +weight: 10 +url: /storage-handling-procedures/ +description: Learn step-by-step how to manage document storage using GroupDocs.Editor Cloud API with these comprehensive developer tutorials. +--- + +# Storage Handling Procedures Tutorials for GroupDocs.Editor Cloud + +Welcome to our comprehensive tutorial series on Document Storage Handling with GroupDocs.Editor Cloud API. These hands-on tutorials are specifically designed for developers who want to master cloud storage operations when working with the GroupDocs.Editor service. + +## Learning Path + +Our tutorial series follows a progressive learning path, starting with basic storage concepts and advancing to more complex operations: + +1. Beginner Level: Learn the fundamentals of storage operations and basic storage management +2. Intermediate Level: Master file and folder manipulation techniques +3. Advanced Level: Implement comprehensive document management workflows + +## Available Tutorials + +### Storage Management Fundamentals + +- [Tutorial: Learn to Work with Storage in GroupDocs.Editor Cloud](/storage-handling-procedures/working-with-storage/) - Learn how to check storage existence, verify file and folder presence, monitor storage usage, and manage file versions with practical code examples. + +### File & Folder Operations + +- [Tutorial: How to Manage Folders in GroupDocs.Editor Cloud](/storage-handling-procedures/working-with-folder/) - Master the essential folder operations including listing files, creating folders, removing directories, and moving or copying folders between locations. + +- [Tutorial: Working with Files in GroupDocs.Editor Cloud](/storage-handling-procedures/working-with-files/) - Learn to download, upload, delete, copy, and move files within your cloud storage for efficient document management. + +## Prerequisites for All Tutorials + +Before beginning these tutorials, please ensure you have: + +- A GroupDocs.Editor Cloud subscription (or [free trial](https://dashboard.groupdocs.cloud/#/apps)) +- Your Client ID and Client Secret ([obtained from the dashboard](https://dashboard.groupdocs.cloud/#/apps)) +- Basic knowledge of REST APIs and your preferred programming language +- Development environment with the appropriate GroupDocs.Editor Cloud SDK installed + +## Getting Help + +Each tutorial includes troubleshooting tips, but if you encounter issues not covered in the guides, please reach out through our support channels. + +## Helpful Resources + +- [Product Page](https://products.groupdocs.cloud/editor/) +- [Documentation](https://docs.groupdocs.cloud/editor/) +- [Live Demo](https://products.groupdocs.app/editor/family) +- [API Reference](https://reference.groupdocs.cloud/editor/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.editor-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/editor/20/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) diff --git a/content/editor/english/storage-handling-procedures/working-with-files/_index.md b/content/editor/english/storage-handling-procedures/working-with-files/_index.md new file mode 100644 index 0000000..a2f66f5 --- /dev/null +++ b/content/editor/english/storage-handling-procedures/working-with-files/_index.md @@ -0,0 +1,451 @@ +--- +title: Working with Files in GroupDocs.Editor Cloud Tutorial +url: /storage-handling-procedures/working-with-files/ +weight: 3 +description: Learn to efficiently manage files in cloud storage with this hands-on tutorial for GroupDocs.Editor Cloud API, covering uploading, downloading, copying, and more. +--- + +# Tutorial: Working with Files in GroupDocs.Editor Cloud + +## Introduction + +In this tutorial, you'll learn how to perform essential file operations using the GroupDocs.Editor Cloud API. Managing individual files efficiently is a critical skill when working with document editing workflows in the cloud. + +- Download files from cloud storage to your application +- Upload new files to your cloud storage +- Delete files when they're no longer needed +- Copy files between different locations +- Move files within your cloud storage structure + + +## Prerequisites + +Before starting this tutorial, make sure you have: + +1. A GroupDocs.Editor Cloud subscription (or [free trial](https://dashboard.groupdocs.cloud/#/apps)) +2. Your Client ID and Client Secret credentials +3. Basic understanding of REST APIs and cloud storage concepts +4. Development environment with your preferred programming language (C#, Java, PHP, Ruby, Node.js, or Python) +5. Corresponding GroupDocs.Editor Cloud SDK installed + +## Use Case Scenario + +Consider a document collaboration platform where users need to upload documents for editing, download edited versions, and manage their document lifecycle. You need to implement robust file handling operations to enable seamless document workflows. + +## Tutorial Steps + +### Step 1: Set Up Authentication + +Before using any file operations, you need to authenticate with the GroupDocs.Editor Cloud API: + +#### Python Setup +```python +import groupdocs_editor_cloud +from groupdocs_editor_cloud import Configuration + +# Create authentication object with your credentials +configuration = Configuration(client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET") +``` + +#### C# Setup +```csharp +using GroupDocs.Editor.Cloud.Sdk.Api; +using GroupDocs.Editor.Cloud.Sdk.Client; + +// Create authentication object +Configuration configuration = new Configuration(clientId: "YOUR_CLIENT_ID", clientSecret: "YOUR_CLIENT_SECRET"); +``` + +### Step 2: Downloading Files from Cloud Storage + +Downloading files is a fundamental operation when you need to retrieve documents from cloud storage for viewing, processing, or local editing. + +#### cURL Example + +```bash +curl -X GET "https://api.groupdocs.cloud/v1.0/editor/storage/file/documents/sample.docx?storageName=MyStorage" -H "accept: multipart/form-data" -H "authorization: Bearer YOUR_ACCESS_TOKEN" +``` + +#### SDK Examples + +##### C# Example + +```csharp +// Create FileApi instance +var fileApi = new FileApi(configuration); + +// Download file +var request = new DownloadFileRequest("documents/sample.docx", "MyStorage"); +var response = fileApi.DownloadFile(request); + +// Save the file to local disk +using (var fileStream = System.IO.File.Create("local-sample.docx")) +{ + response.CopyTo(fileStream); +} + +Console.WriteLine("File downloaded successfully to 'local-sample.docx'"); +``` + +##### Python Example + +```python +# Create FileApi instance +file_api = groupdocs_editor_cloud.FileApi.from_config(configuration) + +# Download file +request = groupdocs_editor_cloud.DownloadFileRequest("documents/sample.docx", "MyStorage") +response = file_api.download_file(request) + +# Save the file to local disk +with open("local-sample.docx", 'wb') as f: + for chunk in response: + f.write(chunk) + +print("File downloaded successfully to 'local-sample.docx'") +``` + +##### Java Example + +```java +// Create FileApi instance +FileApi fileApi = new FileApi(configuration); + +// Download file +DownloadFileRequest request = new DownloadFileRequest("documents/sample.docx", "MyStorage"); +File response = fileApi.downloadFile(request); + +System.out.println("File downloaded successfully: " + response.getPath()); +``` + +### Step 3: Uploading Files to Cloud Storage + +Uploading files allows you to add new documents to your cloud storage, which can later be edited using GroupDocs.Editor. + +#### cURL Example + +```bash +curl -X POST "https://api.groupdocs.cloud/v1.0/editor/storage/file/documents/new-document.docx?storageName=MyStorage" -H "accept: application/json" -H "authorization: Bearer YOUR_ACCESS_TOKEN" -H "Content-Type: multipart/form-data" -F "file=@local-document.docx" +``` + +#### SDK Examples + +##### C# Example + +```csharp +// Create FileApi instance +var fileApi = new FileApi(configuration); + +// Upload file +var request = new UploadFileRequest("documents/new-document.docx", new System.IO.FileStream("local-document.docx", System.IO.FileMode.Open), "MyStorage"); +var response = fileApi.UploadFile(request); + +// Print results +Console.WriteLine($"File uploaded successfully! Uploaded to: {response.Uploaded[0]}"); +``` + +##### Python Example + +```python +# Create FileApi instance +file_api = groupdocs_editor_cloud.FileApi.from_config(configuration) + +# Upload file +request = groupdocs_editor_cloud.UploadFileRequest("documents/new-document.docx", "local-document.docx", "MyStorage") +response = file_api.upload_file(request) + +# Print results +print(f"File uploaded successfully! Uploaded to: {response.uploaded[0]}") +``` + +##### Java Example + +```java +// Create FileApi instance +FileApi fileApi = new FileApi(configuration); + +// Upload file +java.io.File file = new java.io.File("local-document.docx"); +UploadFileRequest request = new UploadFileRequest("documents/new-document.docx", file, "MyStorage"); +FilesUploadResult response = fileApi.uploadFile(request); + +// Print results +System.out.println("File uploaded successfully! Uploaded to: " + response.getUploaded().get(0)); +``` + +### Step 4: Deleting Files from Cloud Storage + +Deleting files helps manage your storage space and remove documents that are no longer needed. + +#### cURL Example + +```bash +curl -X DELETE "https://api.groupdocs.cloud/v1.0/editor/storage/file/documents/old-version.docx?storageName=MyStorage" -H "accept: application/json" -H "authorization: Bearer YOUR_ACCESS_TOKEN" +``` + +#### SDK Examples + +##### C# Example + +```csharp +// Create FileApi instance +var fileApi = new FileApi(configuration); + +// Delete file +var request = new DeleteFileRequest("documents/old-version.docx", "MyStorage"); +fileApi.DeleteFile(request); + +Console.WriteLine("File deleted successfully"); +``` + +##### Python Example + +```python +# Create FileApi instance +file_api = groupdocs_editor_cloud.FileApi.from_config(configuration) + +# Delete file +request = groupdocs_editor_cloud.DeleteFileRequest("documents/old-version.docx", "MyStorage") +file_api.delete_file(request) + +print("File deleted successfully") +``` + +##### Java Example + +```java +// Create FileApi instance +FileApi fileApi = new FileApi(configuration); + +// Delete file +DeleteFileRequest request = new DeleteFileRequest("documents/old-version.docx", "MyStorage"); +fileApi.deleteFile(request); + +System.out.println("File deleted successfully"); +``` + +### Step 5: Copying Files in Cloud Storage + +Copying files allows you to duplicate documents within your storage, which is useful for creating backups or variations of documents. + +#### cURL Example + +```bash +curl -X PUT "https://api.groupdocs.cloud/v1.0/editor/storage/file/copy/documents/original.docx?destPath=documents/archive/original.docx&storageName=MyStorage" -H "accept: application/json" -H "authorization: Bearer YOUR_ACCESS_TOKEN" +``` + +#### SDK Examples + +##### C# Example + +```csharp +// Create FileApi instance +var fileApi = new FileApi(configuration); + +// Copy file +var request = new CopyFileRequest( + srcPath: "documents/original.docx", + destPath: "documents/archive/original.docx", + srcStorageName: "MyStorage", + destStorageName: "MyStorage" +); +fileApi.CopyFile(request); + +Console.WriteLine("File copied successfully"); +``` + +##### Python Example + +```python +# Create FileApi instance +file_api = groupdocs_editor_cloud.FileApi.from_config(configuration) + +# Copy file +request = groupdocs_editor_cloud.CopyFileRequest( + src_path="documents/original.docx", + dest_path="documents/archive/original.docx", + src_storage_name="MyStorage", + dest_storage_name="MyStorage" +) +file_api.copy_file(request) + +print("File copied successfully") +``` + +##### Java Example + +```java +// Create FileApi instance +FileApi fileApi = new FileApi(configuration); + +// Copy file +CopyFileRequest request = new CopyFileRequest( + "documents/original.docx", + "documents/archive/original.docx", + "MyStorage", + "MyStorage" +); +fileApi.copyFile(request); + +System.out.println("File copied successfully"); +``` + +### Step 6: Moving Files in Cloud Storage + +Moving files allows you to reorganize your documents by relocating them to different folders within your storage structure. + +#### cURL Example + +```bash +curl -X PUT "https://api.groupdocs.cloud/v1.0/editor/storage/file/move/documents/draft.docx?destPath=documents/final/approved.docx&storageName=MyStorage" -H "accept: application/json" -H "authorization: Bearer YOUR_ACCESS_TOKEN" +``` + +#### SDK Examples + +##### C# Example + +```csharp +// Create FileApi instance +var fileApi = new FileApi(configuration); + +// Move file +var request = new MoveFileRequest( + srcPath: "documents/draft.docx", + destPath: "documents/final/approved.docx", + srcStorageName: "MyStorage", + destStorageName: "MyStorage" +); +fileApi.MoveFile(request); + +Console.WriteLine("File moved successfully"); +``` + +##### Python Example + +```python +# Create FileApi instance +file_api = groupdocs_editor_cloud.FileApi.from_config(configuration) + +# Move file +request = groupdocs_editor_cloud.MoveFileRequest( + src_path="documents/draft.docx", + dest_path="documents/final/approved.docx", + src_storage_name="MyStorage", + dest_storage_name="MyStorage" +) +file_api.move_file(request) + +print("File moved successfully") +``` + +##### Java Example + +```java +// Create FileApi instance +FileApi fileApi = new FileApi(configuration); + +// Move file +MoveFileRequest request = new MoveFileRequest( + "documents/draft.docx", + "documents/final/approved.docx", + "MyStorage", + "MyStorage" +); +fileApi.moveFile(request); + +System.out.println("File moved successfully"); +``` + +## Creating a Complete File Management Workflow + +Now that you've learned the individual file operations, let's see how to combine them into a practical workflow. The following example demonstrates a complete document processing cycle: + +```csharp +// File management workflow example in C# +public void ProcessDocument(string sourceFilePath, string fileName, string storageName) +{ + try + { + // 1. Upload the document + Console.WriteLine("1. Uploading document..."); + var uploadRequest = new UploadFileRequest(sourceFilePath, new FileStream(fileName, FileMode.Open), storageName); + var uploadResult = fileApi.UploadFile(uploadRequest); + Console.WriteLine($" Document uploaded to {uploadResult.Uploaded[0]}"); + + // 2. Create a backup copy in archive folder + Console.WriteLine("2. Creating backup copy..."); + var destPath = Path.Combine(Path.GetDirectoryName(sourceFilePath), "archive", Path.GetFileName(sourceFilePath)); + var copyRequest = new CopyFileRequest(sourceFilePath, destPath, storageName, storageName); + fileApi.CopyFile(copyRequest); + Console.WriteLine($" Backup created at {destPath}"); + + // 3. Download the file for local processing + Console.WriteLine("3. Downloading document for processing..."); + var downloadRequest = new DownloadFileRequest(sourceFilePath, storageName); + var fileStream = fileApi.DownloadFile(downloadRequest); + var localPath = Path.GetFileName(sourceFilePath); + using (var outputStream = File.Create(localPath)) + { + fileStream.CopyTo(outputStream); + } + Console.WriteLine($" Document downloaded to {localPath}"); + + // 4. After processing, move the file to a processed folder + Console.WriteLine("4. Moving document to processed folder..."); + var processedPath = Path.Combine("processed", Path.GetFileName(sourceFilePath)); + var moveRequest = new MoveFileRequest(sourceFilePath, processedPath, storageName, storageName); + fileApi.MoveFile(moveRequest); + Console.WriteLine($" Document moved to {processedPath}"); + + Console.WriteLine("Document processing workflow complete!"); + } + catch (Exception ex) + { + Console.WriteLine($"Error: {ex.Message}"); + } +} +``` + +This workflow demonstrates a typical document processing scenario where you: +1. Upload a document to cloud storage +2. Create a backup copy for safety +3. Download it for local processing +4. Move it to a different location after processing + +## Troubleshooting Tips + +- File Existence: Before performing operations, check if files exist to avoid errors. +- Path Formatting: Always use forward slashes (`/`) in file paths for consistency. +- Special Characters: Be cautious with special characters in filenames, as they may need encoding. +- Storage Space: Monitor your storage space to ensure you have enough capacity for uploads. +- Permissions: Ensure your API credentials have the necessary permissions for file operations. +- Error Handling: Implement robust error handling to manage failed operations gracefully. + +## What You've Learned + +In this tutorial, you've learned how to: +- Download files from cloud storage for local processing +- Upload documents to your cloud storage +- Delete files to manage your storage efficiently +- Copy files to create backups or variations +- Move files to organize your document structure +- Combine these operations into a complete document workflow + +These file management skills are essential for building robust document editing applications with GroupDocs.Editor Cloud. + +## Further Practice + +To reinforce your learning, try these exercises: +1. Create a file synchronization tool that keeps local and cloud files in sync +2. Build a document conversion pipeline that processes files through upload, conversion, and download +3. Implement a file versioning system that maintains multiple versions of documents + +## Helpful Resources + +- [Product Page](https://products.groupdocs.cloud/editor/) +- [Documentation](https://docs.groupdocs.cloud/editor/) +- [Live Demo](https://products.groupdocs.app/editor/family) +- [API Reference](https://reference.groupdocs.cloud/editor/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.editor-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/editor/20/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) diff --git a/content/editor/english/storage-handling-procedures/working-with-folder/_index.md b/content/editor/english/storage-handling-procedures/working-with-folder/_index.md new file mode 100644 index 0000000..02ff970 --- /dev/null +++ b/content/editor/english/storage-handling-procedures/working-with-folder/_index.md @@ -0,0 +1,343 @@ +--- +title: How to Manage Folders in GroupDocs.Editor Cloud Tutorial +url: /storage-handling-procedures/working-with-folder/ +weight: 2 +description: Learn how to efficiently manage folders in cloud storage with this step-by-step tutorial for GroupDocs.Editor Cloud API, including listing, creating, and moving folders. +--- + +# Tutorial: How to Manage Folders in GroupDocs.Editor Cloud + +## Introduction + +In this tutorial, you'll learn how to perform essential folder management operations using the GroupDocs.Editor Cloud API. Proper folder organization is crucial for efficient document management, especially when working with numerous files in various states of editing. + +Learning Objectives: +- List files within specific folders in cloud storage +- Create new folders for document organization +- Delete folders when they're no longer needed +- Copy folder contents between different locations +- Move folders within your cloud storage structure + +## Prerequisites + +Before starting this tutorial, make sure you have: + +1. A GroupDocs.Editor Cloud subscription (or [free trial](https://dashboard.groupdocs.cloud/#/apps)) +2. Your Client ID and Client Secret credentials +3. Basic understanding of REST APIs and cloud storage concepts +4. Development environment with your preferred programming language (C#, Java, PHP, Ruby, Node.js, or Python) +5. Corresponding GroupDocs.Editor Cloud SDK installed + +## Use Case Scenario + +Imagine you're developing a document management system that allows users to organize their documents in folders. You need to implement functionality for browsing folder contents, creating new organizational structures, and reorganizing existing content through copy or move operations. + +## Tutorial Steps + +### Step 1: Set Up Authentication + +Before using any folder operations, you need to authenticate with the GroupDocs.Editor Cloud API: + +Try it yourself: Set up authentication in your preferred language + +#### Python Setup +```python +import groupdocs_editor_cloud +from groupdocs_editor_cloud import Configuration + +# Create authentication object with your credentials +configuration = Configuration(client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET") +``` + +#### C# Setup +```csharp +using GroupDocs.Editor.Cloud.Sdk.Api; +using GroupDocs.Editor.Cloud.Sdk.Client; + +// Create authentication object +Configuration configuration = new Configuration(clientId: "YOUR_CLIENT_ID", clientSecret: "YOUR_CLIENT_SECRET"); +``` + +### Step 2: Listing Files in a Folder + +One of the most common operations is retrieving a list of files from a specific folder. This allows users to browse available documents and understand the folder structure. + +#### cURL Example + +```bash +curl -X GET "https://api.groupdocs.cloud/v1.0/editor/storage/folder/mydocuments?storageName=MyStorage" -H "accept: application/json" -H "authorization: Bearer YOUR_ACCESS_TOKEN" +``` + +#### SDK Examples + +##### C# Example + +```csharp +// Create FolderApi instance +var folderApi = new FolderApi(configuration); + +// Get files list +var request = new GetFilesListRequest("mydocuments", "MyStorage"); +var response = folderApi.GetFilesList(request); + +// Print files info +Console.WriteLine($"Files in the folder 'mydocuments':"); +foreach (var fileInfo in response.Value) +{ + Console.WriteLine($"Name: {fileInfo.Name}, Size: {fileInfo.Size} bytes"); + Console.WriteLine($"Is Folder: {fileInfo.IsFolder}, Path: {fileInfo.Path}"); + Console.WriteLine($"Modified Date: {fileInfo.ModifiedDate}"); + Console.WriteLine(); +} +``` + +##### Python Example + +```python +# Create FolderApi instance +folder_api = groupdocs_editor_cloud.FolderApi.from_config(configuration) + +# Get files list +request = groupdocs_editor_cloud.GetFilesListRequest("mydocuments", "MyStorage") +response = folder_api.get_files_list(request) + +# Print files info +print(f"Files in the folder 'mydocuments':") +for file_info in response.value: + print(f"Name: {file_info.name}, Size: {file_info.size} bytes") + print(f"Is Folder: {file_info.is_folder}, Path: {file_info.path}") + print(f"Modified Date: {file_info.modified_date}") + print() +``` + +##### Java Example + +```java +// Create FolderApi instance +FolderApi folderApi = new FolderApi(configuration); + +// Get files list +GetFilesListRequest request = new GetFilesListRequest("mydocuments", "MyStorage"); +FilesList response = folderApi.getFilesList(request); + +// Print files info +System.out.println("Files in the folder 'mydocuments':"); +for (FileInfo fileInfo : response.getValue()) { + System.out.println("Name: " + fileInfo.getName() + ", Size: " + fileInfo.getSize() + " bytes"); + System.out.println("Is Folder: " + fileInfo.getIsFolder() + ", Path: " + fileInfo.getPath()); + System.out.println("Modified Date: " + fileInfo.getModifiedDate()); + System.out.println(); +} +``` + +### Step 3: Creating a New Folder + +To organize documents effectively, you often need to create new folders. This operation allows you to create a folder structure that meets your organizational needs. + +#### cURL Example + +```bash +curl -X POST "https://api.groupdocs.cloud/v1.0/editor/storage/folder/mydocuments/reports?storageName=MyStorage" -H "accept: application/json" -H "authorization: Bearer YOUR_ACCESS_TOKEN" +``` + +#### SDK Examples + +##### C# Example + +```csharp +// Create FolderApi instance +var folderApi = new FolderApi(configuration); + +// Create folder +var request = new CreateFolderRequest("mydocuments/reports", "MyStorage"); +folderApi.CreateFolder(request); + +Console.WriteLine("Folder 'reports' created successfully in 'mydocuments'"); +``` + +##### Python Example + +```python +# Create FolderApi instance +folder_api = groupdocs_editor_cloud.FolderApi.from_config(configuration) + +# Create folder +request = groupdocs_editor_cloud.CreateFolderRequest("mydocuments/reports", "MyStorage") +folder_api.create_folder(request) + +print("Folder 'reports' created successfully in 'mydocuments'") +``` + +### Step 4: Deleting a Folder + +When a folder is no longer needed, you can delete it to keep your storage organized. The API allows you to delete folders either recursively (including all contents) or only if they're empty. + +#### cURL Example + +```bash +curl -X DELETE "https://api.groupdocs.cloud/v1.0/editor/storage/folder/mydocuments/old-reports?storageName=MyStorage&recursive=true" -H "accept: application/json" -H "authorization: Bearer YOUR_ACCESS_TOKEN" +``` + +#### SDK Examples + +##### C# Example + +```csharp +// Create FolderApi instance +var folderApi = new FolderApi(configuration); + +// Delete folder recursively +var request = new DeleteFolderRequest("mydocuments/old-reports", "MyStorage", true); +folderApi.DeleteFolder(request); + +Console.WriteLine("Folder 'old-reports' deleted successfully including all its contents"); +``` + +##### Python Example + +```python +# Create FolderApi instance +folder_api = groupdocs_editor_cloud.FolderApi.from_config(configuration) + +# Delete folder recursively +request = groupdocs_editor_cloud.DeleteFolderRequest("mydocuments/old-reports", "MyStorage", True) +folder_api.delete_folder(request) + +print("Folder 'old-reports' deleted successfully including all its contents") +``` + +### Step 5: Copying a Folder + +Sometimes you need to duplicate a folder structure, perhaps to create a backup or a new version. The copy operation allows you to duplicate folders along with their contents. + +#### cURL Example + +```bash +curl -X PUT "https://api.groupdocs.cloud/v1.0/editor/storage/folder/copy/mydocuments/reports?destPath=mydocuments/backup/reports&storageName=MyStorage" -H "accept: application/json" -H "authorization: Bearer YOUR_ACCESS_TOKEN" +``` + +#### SDK Examples + +##### C# Example + +```csharp +// Create FolderApi instance +var folderApi = new FolderApi(configuration); + +// Copy folder +var request = new CopyFolderRequest( + srcPath: "mydocuments/reports", + destPath: "mydocuments/backup/reports", + srcStorageName: "MyStorage", + destStorageName: "MyStorage" +); +folderApi.CopyFolder(request); + +Console.WriteLine("Folder 'reports' copied successfully to 'mydocuments/backup/reports'"); +``` + +##### Python Example + +```python +# Create FolderApi instance +folder_api = groupdocs_editor_cloud.FolderApi.from_config(configuration) + +# Copy folder +request = groupdocs_editor_cloud.CopyFolderRequest( + src_path="mydocuments/reports", + dest_path="mydocuments/backup/reports", + src_storage_name="MyStorage", + dest_storage_name="MyStorage" +) +folder_api.copy_folder(request) + +print("Folder 'reports' copied successfully to 'mydocuments/backup/reports'") +``` + +### Step 6: Moving a Folder + +The move operation allows you to reorganize your folder structure by relocating folders. This is particularly useful when restructuring your document organization. + +#### cURL Example + +```bash +curl -X PUT "https://api.groupdocs.cloud/v1.0/editor/storage/folder/move/mydocuments/drafts?destPath=mydocuments/archive/2024/drafts&storageName=MyStorage" -H "accept: application/json" -H "authorization: Bearer YOUR_ACCESS_TOKEN" +``` + +#### SDK Examples + +##### C# Example + +```csharp +// Create FolderApi instance +var folderApi = new FolderApi(configuration); + +// Move folder +var request = new MoveFolderRequest( + srcPath: "mydocuments/drafts", + destPath: "mydocuments/archive/2024/drafts", + srcStorageName: "MyStorage", + destStorageName: "MyStorage" +); +folderApi.MoveFolder(request); + +Console.WriteLine("Folder 'drafts' moved successfully to 'mydocuments/archive/2024/drafts'"); +``` + +##### Python Example + +```python +# Create FolderApi instance +folder_api = groupdocs_editor_cloud.FolderApi.from_config(configuration) + +# Move folder +request = groupdocs_editor_cloud.MoveFolderRequest( + src_path="mydocuments/drafts", + dest_path="mydocuments/archive/2024/drafts", + src_storage_name="MyStorage", + dest_storage_name="MyStorage" +) +folder_api.move_folder(request) + +print("Folder 'drafts' moved successfully to 'mydocuments/archive/2024/drafts'") +``` + +## Troubleshooting Tips + +- Path Formatting: Always use forward slashes (`/`) in folder paths and ensure there's no trailing slash. +- Recursive Deletion: Be careful when using recursive deletion as it permanently removes all contents. Always confirm before proceeding. +- Folder Existence: Before copying or moving, verify that the destination path's parent folder already exists. +- Permission Issues: Ensure your account has the necessary permissions for all operations. +- Error Handling: Implement proper error handling to manage cases where folders might not exist or operations fail. + +## What You've Learned + +In this tutorial, you've learned how to: +- List files within folders to browse the contents +- Create new folders to organize your documents +- Delete folders when they're no longer needed +- Copy folder structures to duplicate document collections +- Move folders to reorganize your storage hierarchy + +These folder management skills form the foundation of efficient document organization and will help you build more structured and maintainable document workflows. + +## Further Practice + +To reinforce your learning, try these exercises: +1. Create a folder browser application that displays the folder hierarchy +2. Implement a folder backup utility that copies folders at scheduled intervals +3. Build a folder cleanup tool that identifies and removes empty folders + +## Next Steps + +Now that you've mastered folder operations, continue to the next tutorial to learn about [working with files in GroupDocs.Editor Cloud](/storage-handling-procedures/working-with-files/). + +## Helpful Resources + +- [Product Page](https://products.groupdocs.cloud/editor/) +- [Documentation](https://docs.groupdocs.cloud/editor/) +- [Live Demo](https://products.groupdocs.app/editor/family) +- [API Reference](https://reference.groupdocs.cloud/editor/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.editor-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/editor/20/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) diff --git a/content/editor/english/storage-handling-procedures/working-with-storage/_index.md b/content/editor/english/storage-handling-procedures/working-with-storage/_index.md new file mode 100644 index 0000000..56f986c --- /dev/null +++ b/content/editor/english/storage-handling-procedures/working-with-storage/_index.md @@ -0,0 +1,283 @@ +--- +title: Learn to Work with Storage in GroupDocs.Editor Cloud +url: /storage-handling-procedures/working-with-storage/ +weight: 1 +description: This tutorial teaches developers how to manage cloud storage operations in GroupDocs.Editor Cloud including checking storage existence and monitoring usage. +--- + +# Tutorial: Learn to Work with Storage in GroupDocs.Editor Cloud + +## Introduction + +In this comprehensive tutorial, you'll learn how to perform essential storage operations using the GroupDocs.Editor Cloud API. Understanding cloud storage operations is fundamental when working with document editing services, as proper storage management ensures efficient document workflows. + +Learning Objectives: +- Verify the existence of a storage in your account +- Check if a specific file or folder exists in your storage +- Monitor storage space usage +- Retrieve file version information + +## Prerequisites + +Before starting this tutorial, make sure you have: + +1. A GroupDocs.Editor Cloud subscription (or [free trial](https://dashboard.groupdocs.cloud/#/apps)) +2. Your Client ID and Client Secret credentials +3. Basic understanding of REST APIs +4. Development environment with the preferred programming language (C#, Java, PHP, Ruby, Node.js, or Python) +5. Corresponding GroupDocs.Editor Cloud SDK installed + +## Use Case Scenario + +Consider a document management application that needs to perform various checks before processing documents. You need to verify storage availability, check file existence, monitor space usage, and track file versions to ensure smooth operation. + +## Tutorial Steps + +### Step 1: Set Up Authentication + +Before using any storage operations, you need to authenticate with the GroupDocs.Editor Cloud API. All SDKs require your Client ID and Client Secret for this. + +#### Python Setup: +```python +import groupdocs_editor_cloud +from groupdocs_editor_cloud import Configuration + +# Create authentication object with your credentials +configuration = Configuration(client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET") +``` + +#### C# Setup: +```csharp +using GroupDocs.Editor.Cloud.Sdk.Api; +using GroupDocs.Editor.Cloud.Sdk.Client; + +// Create authentication object +Configuration configuration = new Configuration(clientId: "YOUR_CLIENT_ID", clientSecret: "YOUR_CLIENT_SECRET"); +``` + +### Step 2: Checking Storage Existence + +The first operation we'll learn is how to check if a specific storage exists in your account. This is useful when you need to verify that the storage is properly configured before proceeding with other operations. + + +#### cURL Example + +```bash +curl -X GET "https://api.groupdocs.cloud/v1.0/editor/storage/MyStorage/exist" -H "accept: application/json" -H "authorization: Bearer YOUR_ACCESS_TOKEN" +``` + +#### SDK Examples + +##### C# Example + +```csharp +// Create StorageApi instance +var storageApi = new StorageApi(configuration); + +// Check if storage exists +var request = new StorageExistsRequest("MyStorage"); +var response = storageApi.StorageExists(request); + +// Print result +Console.WriteLine($"Storage exists: {response.Exists}"); +``` + +##### Python Example + +```python +# Create StorageApi instance +storage_api = groupdocs_editor_cloud.StorageApi.from_config(configuration) + +# Check if storage exists +request = groupdocs_editor_cloud.StorageExistsRequest("MyStorage") +response = storage_api.storage_exists(request) + +# Print result +print(f"Storage exists: {response.exists}") +``` + +##### Java Example + +```java +// Create StorageApi instance +StorageApi storageApi = new StorageApi(configuration); + +// Check if storage exists +StorageExistsRequest request = new StorageExistsRequest("MyStorage"); +StorageExistsResponse response = storageApi.storageExists(request); + +// Print result +System.out.println("Storage exists: " + response.getExists()); +``` + +### Step 3: Checking File or Folder Existence + +Often, you need to check whether a specific file or folder exists in your storage before performing operations on it. This helps prevent errors and ensures that your code handles missing files properly. + +#### cURL Example + +```bash +curl -X GET "https://api.groupdocs.cloud/v1.0/editor/storage/exist/mydocuments/sample.docx?storageName=MyStorage" -H "accept: application/json" -H "authorization: Bearer YOUR_ACCESS_TOKEN" +``` + +#### SDK Examples + +##### C# Example + +```csharp +// Create StorageApi instance +var storageApi = new StorageApi(configuration); + +// Check if file exists +var request = new ObjectExistsRequest("mydocuments/sample.docx", "MyStorage"); +var response = storageApi.ObjectExists(request); + +// Print results +Console.WriteLine($"Object exists: {response.Exists}"); +Console.WriteLine($"Is folder: {response.IsFolder}"); +``` + +##### Python Example + +```python +# Create StorageApi instance +storage_api = groupdocs_editor_cloud.StorageApi.from_config(configuration) + +# Check if file exists +request = groupdocs_editor_cloud.ObjectExistsRequest("mydocuments/sample.docx", "MyStorage") +response = storage_api.object_exists(request) + +# Print results +print(f"Object exists: {response.exists}") +print(f"Is folder: {response.is_folder}") +``` + +### Step 4: Monitoring Storage Space Usage + +To ensure your application has sufficient storage space, you should regularly monitor the storage usage. This helps prevent issues with file uploads and other operations that require storage space. + +#### cURL Example + +```bash +curl -X GET "https://api.groupdocs.cloud/v1.0/editor/storage/disc?storageName=MyStorage" -H "accept: application/json" -H "authorization: Bearer YOUR_ACCESS_TOKEN" +``` + +#### SDK Examples + +##### C# Example + +```csharp +// Create StorageApi instance +var storageApi = new StorageApi(configuration); + +// Get storage usage info +var request = new GetDiscUsageRequest("MyStorage"); +var response = storageApi.GetDiscUsage(request); + +// Print results +Console.WriteLine($"Used space: {response.UsedSize} bytes"); +Console.WriteLine($"Total space: {response.TotalSize} bytes"); +``` + +##### Python Example + +```python +# Create StorageApi instance +storage_api = groupdocs_editor_cloud.StorageApi.from_config(configuration) + +# Get storage usage info +request = groupdocs_editor_cloud.GetDiscUsageRequest("MyStorage") +response = storage_api.get_disc_usage(request) + +# Print results +print(f"Used space: {response.used_size} bytes") +print(f"Total space: {response.total_size} bytes") +``` + +### Step 5: Retrieving File Versions + +The API allows you to retrieve version information for a specific file. This is useful for tracking changes to files and ensuring you're working with the correct version. + +#### cURL Example + +```bash +curl -X GET "https://api.groupdocs.cloud/v1.0/editor/storage/version/mydocuments/document.docx?storageName=MyStorage" -H "accept: application/json" -H "authorization: Bearer YOUR_ACCESS_TOKEN" +``` + +#### SDK Examples + +##### C# Example + +```csharp +// Create StorageApi instance +var storageApi = new StorageApi(configuration); + +// Get file versions +var request = new GetFileVersionsRequest("mydocuments/document.docx", "MyStorage"); +var response = storageApi.GetFileVersions(request); + +// Print versions info +foreach (var version in response.Value) +{ + Console.WriteLine($"Version: {version.VersionId}, IsLatest: {version.IsLatest}"); + Console.WriteLine($"Modified date: {version.ModifiedDate}"); + Console.WriteLine($"Size: {version.Size} bytes"); + Console.WriteLine(); +} +``` + +##### Python Example + +```python +# Create StorageApi instance +storage_api = groupdocs_editor_cloud.StorageApi.from_config(configuration) + +# Get file versions +request = groupdocs_editor_cloud.GetFileVersionsRequest("mydocuments/document.docx", "MyStorage") +response = storage_api.get_file_versions(request) + +# Print versions info +for version in response.value: + print(f"Version: {version.version_id}, IsLatest: {version.is_latest}") + print(f"Modified date: {version.modified_date}") + print(f"Size: {version.size} bytes") + print() +``` + +## Troubleshooting Tips + +- Authentication Issues: Make sure your Client ID and Client Secret are correct. Check for any whitespace in the credentials. +- Storage Not Found: Verify the storage name is correctly spelled and exists in your account. +- File Path Issues: Always use forward slashes (`/`) in file paths, not backslashes. +- Permission Problems: Ensure your account has the necessary permissions to access the specified storage. + +## What You've Learned + +In this tutorial, you've learned how to: +- Verify if a specific storage exists in your account +- Check if a file or folder exists in your storage +- Monitor storage space usage to prevent space issues +- Retrieve and examine file version information + +These fundamental storage operations form the foundation for more advanced document management workflows and help ensure your applications run smoothly. + +## Further Practice + +To reinforce your learning, try the following exercises: +1. Create a simple console application that reports storage statistics +2. Build a file existence checker that validates multiple files +3. Implement a storage monitor that alerts when usage exceeds a certain threshold + +## Next Steps + +Now that you've mastered basic storage operations, proceed to the next tutorial to learn about [folder operations in GroupDocs.Editor Cloud](/storage-handling-procedures/working-with-folder/). + +## Helpful Resources + +- [Product Page](https://products.groupdocs.cloud/editor/) +- [Documentation](https://docs.groupdocs.cloud/editor/) +- [Live Demo](https://products.groupdocs.app/editor/family) +- [API Reference](https://reference.groupdocs.cloud/editor/) +- [Blog](https://blog.groupdocs.cloud/categories/groupdocs.editor-cloud-product-family/) +- [Free Support](https://forum.groupdocs.cloud/c/editor/20/) +- [Free Trial](https://dashboard.groupdocs.cloud/#/apps) diff --git a/content/home/english/_index.md b/content/home/english/_index.md index 7dd5cd5..d49288f 100644 --- a/content/home/english/_index.md +++ b/content/home/english/_index.md @@ -29,7 +29,7 @@ Explore our tutorials on adding, editing, and managing annotations in documents. ### [GroupDocs.Comparison Cloud Tutorials](./comparison/) Learn document comparison techniques with our step-by-step guides for detecting changes between document versions, generating visual difference reports, and managing tracked changes. -### [GroupDocs.Editor Cloud Tutorials](#) +### [GroupDocs.Editor Cloud Tutorials](./editor/) Master document editing capabilities with tutorials on embedding document editing functionality into your applications without relying on third-party editors. ### [GroupDocs.Assembly Cloud Tutorials](#)