How to upload and then open ms-word or ms-excel files

The 1C:Enterprise developers forum

People who like this:0Yes/0No
Rating: 10
Joined: Nov 10, 2011
Company: 1A Software e.U


I can upload PDF-Files into 1C-Application and then open them but do not know how does it work with MS-Word or MS-Excel files.
Thank you in advance for every advice!


People who like this:0Yes/0No
Just came
Rating: 0
Joined: Jan 10, 2019
Company: 1c developer

Hello, Lioudmila,

There are several ways to import data from Word and Excel files into 1C. The most common is - using of COM Objects. In the case of Excel tables, I often use this way (using SpreadSheetDocument instead of COM-object):

FileOpenDialog = new FileDialog(FileDialogMode.Open);
FileOpenDialog.Filter = "Excel sheet 97 (*.xls)|*.xls|Excel workbook (*.xlsx)|*xlsx";
FileOpenDialog.Multiselect = False;
FileOpenDialog.Title = "Choose Excel file to open";

If FileOpenDialog.Choose() Then
// --- Parsing choosed file
ExcelFileName = FileOpenDialog.FullFileName;
TableDoc = new SpreadsheetDocument;
LinesCount = TableDoc.PageHeight;

LineNumber = 1;
ColNumber = 1;

While LineNumber <= LinesCount Do
Value = TableDoc.Area(LineNumber, ColNumber).Text; //you can use .Value property also
LineNumber = LineNumber + 1;


it works ;)

it also works in the opposite direction - you can save a SpreadSheetDocument to an XLS file using

TableDoc.Write ("FileName", SpreadsheetDocumentFileType.XLSX);

use the Syntax Help on "SpreadsheetDocumentFileType: type to view all file formats