2

Importing Excel XLSX Spreadsheets into TX Text Control in ASP.NET Core and Windo...

 1 year ago
source link: https://www.textcontrol.com/blog/2023/02/07/importing-excel-xlsx-spreadsheets-into-tx-text-control/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Importing Excel XLSX Spreadsheets into TX Text Control in ASP.NET Core and Windows Forms in C#

All .NET products of TX Text Control including ASP.NET (Core), Windows Forms and WPF provide an Excel XLSX SpreadsheetML filter to import spreadsheets into a document. Spreadsheets included in an Excel document can be imported and converted into a "smart" table including supported formulas, cell number format settings and the included formatting.

Importing Spreadsheets

In order to load spreadsheets from XLSX files into TX Text Control, all file load methods can be utilized including:

  • Selection.Load
  • Append

This allows the insertion of spreadsheets into a new document, into the current input position or at a new section or page. The spreadsheets can be loaded from physical files, byte arrays or streams.

The DocumentPartName property of the LoadSettings is used to define the sheet in the loaded document. The following code is loading spreadsheet 2021 from the document cashflow.xlsx into the current input position.

The following screenshot shows the spreadsheet 2021 opened in Microsoft Excel. This name is used in the DocumentPartName property.

Spreadsheets in Excel Document

After importing the spreadsheet into TX Text Control, you can see the imported formatting, the table cell format and the working formulas:

Spreadsheets in Excel Document

Reference Styles

TX Text Control provides two reference styles to reference cells for formulas: A1 and R1C1.

Spreadsheets in Excel Document

Loading Multiple Spreadsheets

The following code shows how to load multiple spreadsheets into TX Text Control by calling the Selection.Load multiple times:

The following screenshot animation shows the working formulas when changing the associated cell content.

Spreadsheets in Excel Document

ASP.NET

The first true WYSIWYG, HTML5-based Web editor and reporting template designer. Give your users an MS Word compatible editor to create powerful reporting templates anywhere - in any browser on any device. Our ASP.NET components combine the power of a reporting tool and an easy-to-use WYSIWYG word processor - fully programmable and embeddable in your ASP.NET application.

See ASP.NET products


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK