Spire.Office Knowledgebase Page 44 | E-iceblue

View and Edit Word Documents Online

2024-07-24 01:23:09 Written by Koohji

Many people need to work with word processing documents, such as reports, essays, and letters, while on the go or away from their primary computer. Online word processing tools allow you to view, edit, and collaborate on these documents from any internet-connected device. Using an online word processor can improve productivity and accessibility compared to only being able to work on documents locally.

This article demonstrates how to use Spire.Cloud.Office document editor control to view and edit Word documents online.

Spire.Cloud.Office Document Editor

Spire.Cloud.Office is a robust, HTML5-powered document editor component that can be seamlessly integrated into web applications. This component empowers your end-users to view, create, edit, and collaborate on diverse document types entirely within a web browser environment.

In order to take advantage of the services provided by Spire.Cloud.Office, you will need to first install the component on your system.

Once the installation is finished, you can proceed to integrate the Spire.Cloud.Office editor into your own web application. Alternatively, you can visit the example application hosted on port 3000 to explore the editor's full functionality.

View and Edit Word Documents Online

View Word Documents Online

On the example page, click the "Upload File" button to load an existing Word document.

View and Edit Word Documents Online

Once the file has been uploaded, it will appear on the example page. To view the document in full-screen mode in a web browser, click the "computer" icon in the "Viewers" section.

View and Edit Word Documents Online

The document being displayed is in a read-only state.

View and Edit Word Documents Online

Edit Word Documents Online

To open the document for editing, click the computer icon in the "Editors" section.

View and Edit Word Documents Online

Use the editing tools provided in the document editor to make any desired modifications to the file. Once you have finished making your changes, save the updated document by clicking the "File" menu and then selecting the "Save" option.

View and Edit Word Documents Online

Co-Edit Word Documents Online

Spire.Cloud.Office provides robust real-time collaboration capabilities, enabling multiple users to work on the same document simultaneously. The "Review" tab offers two distinct collaborative editing modes:

  • Fast Mode: In this mode, all editors can view the changes made to the document in real-time, as they are typed or applied.
  • Strict Mode: Under this mode, edits made by contributors are shielded from immediate visibility, and only become accessible to other editors after the document has been explicitly saved.

The Fast Mode is the default setting for Spire.Cloud.Office's collaborative editing features.

View and Edit Word Documents Online

When a document is being collaboratively edited by multiple users, any edits made by one editor are immediately visible to all other editors in the document interface, updated in real-time.

View and Edit Word Documents Online

Python: Add a Watermark to Excel

2024-07-23 01:10:21 Written by Koohji

While watermarks are a common design element used in many types of documents to convey ownership, confidentiality, or branding, Microsoft Excel does not provide a built-in watermark feature. However, there are workaround methods to achieve a watermark effect in Excel spreadsheets.

One approach is to add an image to the header or footer of the worksheet, and another approach is to add an image to a worksheet as the background. In this article, you will learn how to add a header or background image watermark to Excel in Python using Spire.XLS for Python.

Install Spire.XLS for Python

This scenario requires Spire.XLS for Python and plum-dispatch v1.7.4. They can be easily installed in your Windows through the following pip command.

pip install Spire.XLS

If you are unsure how to install, please refer to this tutorial: How to Install Spire.XLS for Python on Windows

Header vs Background Image Watermarks

Header Image Watermark:

Advantages:

  • The watermark is preserved on the printed sheet, ensuring it appears in the final output.

Disadvantages:

  • The watermark is invisible under the "Normal" view mode in Excel, only becoming visible in "Page Layout" or "Page Break Preview" views.
  • To centrally position the watermark graphic on the Excel page, you need to carefully adjust the white margins, especially on the top and left sides of the image.

Background Image Watermark:

Advantages:

  • The watermark image covers the entire worksheet area, providing a consistent background appearance.

Disadvantages:

  • The watermark is not preserved on the printed sheet, meaning it will not appear in the final printed output.

Add a Watermark to Excel Using a Header Image in Python

Spire.XLS for Python offers the PageSetup class to control various settings related to the appearance and layout of the printed worksheet. Under this class, you can find the CenterHeader and CenterHeaderImage properties, allowing you set an image for the center section of the header.

Here are the steps to add a header image watermark to Excel using Python.

  • Create a Workbook object.
  • Load an Excel document from a give file path.
  • Load an image while initialing the Stream class.
  • Get a specific worksheet from the workbook.
  • Add an image field to the header center by setting Worksheet.PageSetup.CenterHeader property to "&G".
  • Apply the image to the header center through Worksheet.PageSetup.CenterHeaderImage property.
  • Save the workbook to a different Excel file.
  • Python
from spire.xls import *
from spire.xls.common import *

# Create a Workbook object
workbook = Workbook()

# Load an Excel document
workbook.LoadFromFile("C:\\Users\\Administrator\\Desktop\\Input.xlsx")

# Load an image file
stream = Stream("C:\\Users\\Administrator\\Desktop\\confidential.png")

# Loop through all worksheets in the file
for i in range(workbook.Worksheets.Count):

    # Get a specific worksheet
    worksheet = workbook.Worksheets[i]

    # Add an image field to the header center
    worksheet.PageSetup.CenterHeader = "&G"

    # Add the image to the header center
    worksheet.PageSetup.CenterHeaderImage = stream

# Save the result file
workbook.SaveToFile("output/AddWatermark.xlsx", ExcelVersion.Version2016)

# Dispose resources
workbook.Dispose()

Python: Add a Watermark to Excel

Add a Watermark to Excel Using a Background Image in Python

The PageSetup class provides the BackgroundImage property to get or set the image for the background. Below are the steps to add a background image watermark to Excel using Python.

  • Create a Workbook object.
  • Load an Excel document from a give file path.
  • Load an image while initialing the Stream class.
  • Get a specific worksheet from the workbook.
  • Apply the image to the worksheet as the background through Worksheet.PageSetup.BackgroundImage property.
  • Save the workbook to a different Excel file.
  • Python
from spire.xls import *
from spire.xls.common import *

# Create a Workbook object
workbook = Workbook()

# Load an Excel document
workbook.LoadFromFile("C:\\Users\\Administrator\\Desktop\\Input.xlsx")

# Load an image file
stream = Stream("C:\\Users\\Administrator\\Desktop\\sample-background.png")

# Loop through all worksheets in the file
for i in range(workbook.Worksheets.Count):

    # Get a specific worksheet
    worksheet = workbook.Worksheets[i]

    # Set the image as the background of the worksheet
    worksheet.PageSetup.BackgoundImage = stream

# Save the result file
workbook.SaveToFile("output/AddWatermark.xlsx", ExcelVersion.Version2016)

# Dispose resources
workbook.Dispose()

Python: Add a Watermark to Excel

Apply for a Temporary License

If you'd like to remove the evaluation message from the generated documents, or to get rid of the function limitations, please request a 30-day trial license for yourself.

Excel workbooks have become one of the most commonly used spreadsheet formats. Efficiently managing, editing, and sharing Excel files is a key competency in both personal and professional settings. Editing Excel files and converting them to PDF, CSV, OTS, etc. formats online offers significant advantages. One of the primary benefits is the elimination of reliance on local software installations. Users only need a web browser, making the process accessible from any device, be it a PC or a mobile phone.

Furthermore, online tools facilitate seamless collaboration. Multiple users can access and edit the same document simultaneously, promoting teamwork and keeping information up-to-date. Converting Excel files to PDF online also ensures that documents are universally accessible and secure, maintaining formatting and integrity across different platforms and devices.

This article will show how to edit Excel files and convert Excel files to other formats online with Spire.Cloud.Excel library, realizing cross-platform and efficient online Excel file editing.

Get Spire.Cloud.Excel Online Editor

Spire.Cloud.Excel is a powerful online Excel viewer and editor designed for viewing, creating, editing, and collaborating on Excel documents in HTML5-compliant browsers. It also supports converting spreadsheets to PDF, PDF/A, CSV, and OTS formats.

Spire.Cloud.Excel is currently available on Windows and Linux. Download Spire.Cloud.Excel and follow the guide below to install it on the server:

After installing Spire.Cloud.Excel on your server, you can try out the features of the editor via port 3000 or integrate the editor into your HTML pages via JavaScript.

Edit Excel Files and Convert Them to PDF and Other Formats Online

Load and Modify Excel Workbooks Online

Spire.Cloud.Excel supports uploading a variety of spreadsheet formats for viewing, editing, and conversion, including XLS, XLSX, XLSM, XLSB, XLT, XLTX, XLTM, CSV, ODS, UOS, ET, and ETT.

Spreadsheet files will be automatically converted to Open XML format after uploading so that they can be quickly viewed and edited in the online editor.

Steps to upload an Excel document and edit it online:

1. Open the product home page and select the Upload button.

Edit Excel Files and Convert Them to PDF and Other Formats Online

2. Select a file and upload it. Wait for the format conversion to complete and select Edit.

Edit Excel Files and Convert Them to PDF and Other Formats Online

3. Various modifications and creations can be made to the document within the editor, including cell content editing, formatting, image insertion, page setup, data analysis, chart insertion, worksheet creation, pivot table generation, commenting, and even document printing.

Online editor:

Edit Excel Files and Convert Them to PDF and Other Formats Online

Print spreadsheets:

Edit Excel Files and Convert Them to PDF and Other Formats Online

4. The editor will save changes to the document every 10 minutes, or you can click "File" > "Save" to apply changes manually.

Edit Excel Files and Convert Them to PDF and Other Formats Online

5. When multiple people edit the same document online at the same time, the document changes will be synchronized in real-time, making it easy for users to get content updates in a timely manner and get an efficient collaborative editing experience.

Edit Excel Files and Convert Them to PDF and Other Formats Online

Create a New Excel Workbook Online

In addition to uploading Excel files for viewing and editing, users can also use Spire.Cloud.Excel to create new Excel files online. Below are the steps to create a new Excel file online using Spire.Cloud.Excel:

1. Open the main page and select Create Spreadsheet. When creating, users can also choose "Create a file filled with sample content" to create an Excel document with sample content.

Edit Excel Files and Convert Them to PDF and Other Formats Online

2. Once the document is created, users can edit it in the pop-up online editor.

Edit Excel Files and Convert Them to PDF and Other Formats Online

Convert Excel Files to PDF, PDF/A, OTS, and CSV Online

Spire.Cloud.Excel also supports exporting documents to multiple formats for sharing, presentations, and more. Currently, it supports exporting spreadsheets to XLSX, PDF, CSV, XLTX, PDF/A, and OTS formats to meet various document usage requirements.

Steps for converting Excel files to formats like PDF and OTS:

1. Upload or create an Excel document.

2. After editing, choose "File" > "Download as" in the toolbar.

Edit Excel Files and Convert Them to PDF and Other Formats Online

3. Choose a file format to save the document.

Edit Excel Files and Convert Them to PDF and Other Formats Online

Conclusion

This article demonstrates how to use Spire.Cloud.Excel to preview, edit, print, and convert Excel files to PDF and other formats online. The API also supports many other online document-processing features. Use Spire.Cloud.Excel to create your online document editing projects or embed them into existing web pages for easier and more efficient online spreadsheet processing capabilities.

page 44