What is the name of the program for excel in 1c. Which is better - 1C or Excel? Upload without programming

There are various ways to open an Excel file in 1C and vice versa. Beginner users will prefer simpler operations by saving the document in a different format or using special programs. But it is worth spending a little effort and learning how to work with software tools to view and process data from one program to another. These basic programming skills will help you avoid routine tasks in the future.

How to open Excel documents in 1C and vice versa

The Microsoft Excel spreadsheet editor is superior in functionality to 1C accounting software products. Therefore, 1C users prefer to perform some operations in a spreadsheet editor, and then return the data to the accounting program. And this is not surprising, because previously the accounting of many companies was carried out exclusively using Microsoft programs. But with the current level of automation of business processes of enterprises, it is impossible to abandon specialized programs. To establish interaction between different applications, there are the following simple ways:

    When you have to deal with files of software products that are not installed on your current computer, the easiest way is to use a special application for converting Excel tables into 1C format and vice versa. It can be found on the 1C product website.

    If your computer has both 1C and Excel, you can manually open the file in its “native” application and then save it in the format of another program. Typically this option is available when saving a printable or layout.

    Users of 1C 7.7 can upgrade to version 1C 8, which has an improved table editor.

How 1C and Excel can interact programmatically

Interaction between 1C and Excel can be carried out at the program level using OLE Automation technology developed by Microsoft. It allows you to access COM objects directly from script interpreters of various programs. Simply put, OLE allows you to transfer a piece of work from one program to another, and then return the work to the original application. This is exactly what accountants need from Microsoft's spreadsheet editor.

You don't need to be a programmer to use OLE tools. Although the first acquaintance with lines of code will be accompanied by errors, checking will help to identify them, and the experience gained will help to avoid them in the future. Below are the most popular commands (they are called listings) for working with Excel data in accounting programs and vice versa.

How to open an Excel file in 1C programmatically

So, if both programs are installed on your computer, between which you want to exchange data, then you can organize the interaction programmatically. To do this, you need to launch both applications, and then use OLE to establish access from 1C to Excel:

  • Exception

    Report(ErrorDescription() + "Excel is not installed on this computer!");

  • End of Attempt.

Access to the table editor is installed, now using the following commands you need to gain access to:

    specific document:

    • Book = Excel.WorkBooks.Open(FilePath)

    • Sheet = Book.WorkSheets(SheetNumber);

  • including with a specific sheet number:

    including with a specific sheet name:

    • Sheet = Book.WorkSheets(SheetName);

    • Value = Sheet.Cells(RowNumber, ColumnNumber).Value;

To read data from the first page of a file, use the following listings:

    Excel = CreateObject("Excel.Application");

    Book = Excel.WorkBooks.Open(FilePath);

    Sheet = Book.WorkSheets(1);

    TotalColumns = Sheet.Cells(1,1).SpecialCells(11).Column;

    TotalRows = Sheet.Cells(1,1).SpecialCells(11).Row;

    For Row = 1 By TotalRows Loop

    • For Column = 1 By TotalColumns Cycle

      Value = Abbr(Sheet.Cells(Row,Column).Value);

      EndCycle;

    EndCycle;

Remember, the path to the file must be specified in full. When saving a document name, you cannot include characters such as \, /, :, *, ?, ", >,< и |.

How to open a 1C file through Excel programmatically

To record data in Excel you must:

    or open an existing document:

    • Book = Excel.WorkBooks.Open(Path to File) - by analogy with reading an Excel file from 1C;

    or add a new one:

    • Workbook = Excel.WorkBooks.Add();

    You can create a new sheet in a new document:

    • Sheet = Book.Sheets.Add();

    and add a new value to the cell:

    • Sheet.Cells(RowNumber, ColumnNumber).Value = Value; (methods for writing values ​​using OLE are described in detail on the Internet).

  • Book.SaveAs(FilePath);

    Exception

    Report(ErrorDescription()+"File not saved!");

    End of Attempt.

When you have finished working with the spreadsheet editor, exit using the special command (Excel.Application.Quit();). This method will help save computer resources during further work.

Dangers when exchanging data between 1C and Excel

1C and Excel were developed by different companies and use different ways of handling data. Therefore, when transferring tables from one program to another, remember the following pitfalls:

    Various separators in fractional numbers. Microsoft separates decimal numbers using a comma. Therefore, when transferring tables from an accounting program, do not be surprised by the abundance of dates and other confusion. It's just that in an accounting program, a period may be used in writing fractions, which the Microsoft spreadsheet editor will interpret as a date separator, and 15.5 will turn into May 15th. To process accounting data in a spreadsheet editor, the separator will have to be replaced with a comma.

    When transferring data from Excel to 1C, those Excel constants that are not in the accounting program may be displayed incorrectly. To decipher them, you need to go to the spreadsheet editor Help or into debugging mode and check the numerical expression of various constants.

If you need to exchange large amounts of data or cannot get rid of errors, contact the professionals of the Setby company for help. We will help you solve your problems at the program level and understand the commands necessary for your work.

Quite often, when communicating with potential clients, I hear that the table functionality from the office package is quite enough for them, and they do not see the point in 1C programs. This is because some people still associate this solution only with programs for accountants, which is not true.

Excel is a universal and mass-produced product, you can’t argue with that. Almost everyone can use this program, unlike 1C developments, which are aimed at narrow specialists. Using “green” tables, you can freely implement the necessary functionality, which will be convenient: here is the financial model of the organization with all mutual settlements, management accounting, even regulated ones, a large selection of data visualization, the ability to independently expand the capabilities of the program using various add-ons - everything is in your hands , everything from scratch...

It’s good if you are just starting your business, gradually taking into account the necessary data in the table on relationships with clients, suppliers, regulatory authorities, building your own arbitrary structure, but what to do next when the database becomes voluminous and the staff numbers in the dozens? Still count according to your own parameters? I am for not confusing convenience with habit, which often interferes with the systematization of the business, and, consequently, its optimization.

For clarity, let’s imagine what needs may arise for accounting automation, for example, for trade:

1. Analysis of sales within a certain period.

The head of the sales department can analyze sales data. It is important for him to understand whether the plan is being implemented, how effective his strategies are, so that in case of ineffectiveness, he can make timely adjustments to the work.

2. Warehouse accounting.
Do I need to explain that for sales it is also important to understand the availability of goods in stock, which goods can be reserved and which are out of stock and what needs to be ordered? I think everything is clear here.

3. Maintaining a database of counterparties.
Even if the owner sells only what can be bought here and now, which is typical for the B2C sector, then he has a slightly different relationship with the supplier base - contracts, primary... Imagine how convenient it is when everything connected with the supplier is automatically Is it immediately displayed in a single database? The manager in charge of the warehouse immediately sees the availability of goods in the warehouse, another employee responsible for documents monitors information on their availability, whether all obligations under contractual relations are being fulfilled, who owes whom and how much. And in case of discrepancies, you can reconcile data for a certain period, generating a result in less than a minute.

4. Profit of the organization.
Generating a profit report will not be difficult, since all the data on expenses and income is already present in the database. Provided that the information is entered in a timely manner, at least by the required date. The fundamental factor here is the personal responsibility of the user.

If you do not have many clients and suppliers, Excel will really suit you, since there is plenty of time to design your own diagrams in the table and fill them out, followed by distributing documents into various folders on the computer: contracts, suppliers, clients, clients in the neighborhood , clients in development, clients to be deleted – an endless and fascinating process of creating folders within a folder. And if there is a lot of information, is it convenient to keep track of your database? Of course, there are always exceptions; sometimes there are organizations with large turnovers whose financial data is maintained only in Excel. How much time does it take them to exchange and combine data between departments? I will answer: a lot.

I can’t imagine how to quickly find the one you need in a large number of Excel documents organized in an arbitrary system. For example, when providing documents for requirements from the tax office. How will an accountant submit reports to regulatory authorities when the information is all scattered? Accounting, of course, can be outsourced and some business owners, unfortunately, may not care what processes a given specialist may have as long as he balances the balances. But even if so, then how is the process of document exchange organized? How quickly will an external employee understand the improvised information structure?

I can’t say the same about 1C, since all the information there is structured and interconnected:

    A single database for both remote and full-time employees, in which you can work with all standardized and custom documents;
    Reporting to regulatory authorities is generated on the basis of data that is already reflected in the program; there is no need to open many files, combine several values ​​into one table to obtain final results.
“1C”, in a good way, is a multitasking system that is aimed both at typical accounting tasks and at automating all organizational processes, depending on the field of activity. The main word here is system. No one is stopping you from organizing your business system in Excel, but why reinvent the wheel when there are solutions that cover almost all the needs for optimizing time and financial costs, helping to systematize your work?

In defense of Excel

It probably seemed to you that I am against constructing data in “green” tables. Not at all. In fact, I myself often do some business in Excel: if I need arbitrary calculations, if I need to segment data by client, conducting analytics based on parameters that are not in 1C - yes, this happens - I go to " Excel." Simply put, in tables I do calculations and non-standard analysis, but then I systematize everything in 1C anyway.

And then, to view downloaded files from 1C you will still need Excel, since the data in 1C is stored in spreadsheets. Do you feel like this is a vicious circle? I’ll say it differently: “1C” and “Excel” go side by side like two partners, but each of them has its own purpose, they complement each other well, but do not replace each other.

If you need to systematize your affairs taking into account the legislative system of our state, taking into account the specifics and focus of the business, especially when it comes to large volumes of information, then you need 1C. If you need arbitrary calculations, building a strategy from scratch, visualizing non-standard analytics data, then Excel is at your service. But it is much more convenient to work with these solutions simultaneously.


What is the end result – “1C” or “Excel”?

At the very beginning, if the question is about finances for automation, although basic 1C programs do not cost that much money, I would use Excel. A huge plus is that data from “green” tables can be loaded into 1C without loss. But as you scale, I would advise you to pay attention to programs for automating business processes. There are many of them, and it may not necessarily be 1C...

The transition to “1C” can be carried out when you understand that you need to optimize your resources, including automating issues related to relationships with clients and suppliers, and with supervisory authorities. In general, adjust your work processes to increase business efficiency when processing information will take a lot of time, and Excel files will no longer cope with the volume of input data.

However, not every “1C” may be suitable for you; you need to take into account various factors: the specifics and scope of the business, the scale, the need for daily tasks, the routine that needs to be minimized. Everything is individual. The truth, as I already said, is somewhere between “1C” and “Excel” - it complements each other.

That's probably all. But if you have any questions, please contact us, we will try to help you. Successful business processes, colleagues!

This method is simple. Its essence is that the object TabularDocument has methods:

  • Write down (< ИмяФайла>, < ТипФайлаТаблицы >) to upload data to a file;
  • Read (< ИмяФайла>, < СпособЧтенияЗначений >) to load data from a file.

Attention!

The Write() method is available on both the client and the server. The Read() method is only available on the server side. Need to remember this
when planning client-server interaction.

Let's look at an example of saving a spreadsheet document to a file. It is necessary to create and fill the TabularDocument object in any way, and unloading to the file is done with just one line:

TabDoc . Write(FilePath, TabularDocumentFileType. XLSX);

Here TabDoc- generated spreadsheet document, The path to the file— name of the file to upload, TabularDocumentFileType.XLSX— format of the created file. The following Excel formats are supported:

  • XLS95 - Excel 95 format;
  • XLS97 - Excel 97 format;
  • XLSX is an Excel 2007 format.

TabDoc = New TabularDocument;
TabDoc . Read(PathToFile, Method of ReadingTabularDocumentValues.Value);

Here The path to the file— path to the downloaded Excel file. Method of Reading Values ​​of a Tabular Document.Value determines how data read from a source document should be interpreted. Available options:

  • Meaning;
  • Text.

Exchange via OLE

Exchange through OLE automation technology is perhaps the most common option for programmatically working with Excel files. It allows you to use all the functionality provided by Excel, but is slower compared to other methods. To exchange via OLE, MS Excel installation is required:

  • On the end user's computer, if the exchange occurs on the client side;
  • On the 1C:Enterprise server computer, if the exchange occurs on the server side.

Example unloading:

// Create a COM object
Excel = New COMObject("Excel.Application");
// Disable warnings and questions
Excel . DisplayAlerts = False;
// Create a new book
Book = Excel. WorkBooks. Add();
// Position on the first sheet
Sheet = Book. Worksheets(1);

// Write a value to a cell
Sheet . Cells(RowNumber, ColumnNumber). Value = CellValue;

// Save the file
Book . SaveAs(FileName);


Excel . Quit();
Excel = 0;

Examples reading:

// -- OPTION 1 --

// Create a COM object
Excel = New COMObject("Excel.Application");
// Open a book
Book = Excel. Workbooks. Open( The path to the file );

Sheet = Book. Worksheets(1);

// Closing the book
Book . Close(0);

// Close Excel and free up memory
Excel . Quit();
Excel = 0;

// —— OPTION 2 ——

// Open a book
Book = GetCOMObject( The path to the file );
// Positioning on the desired sheet
Sheet = Book. Worksheets(1);

// Read the cell value, usually the cell traversal loop is located here
CellValue = Sheet. Cells(RowNumber, ColumnNumber). Value;

// Closing the book
Book . Application. Qui t();

For bypass For all completed rows of the Excel worksheet, you can use the following techniques:

// -- OPTION 1 --
Number of Rows = Sheet. Cells(1 , 1 ). SpecialCells(11). Row;
For RowNumber = 1 By Number Of Rows Cycle
CellValue = Sheet. Cells(RowNumber, ColumnNumber). Value;
EndCycle;

// —— OPTION 2 ——
RowNumber = 0 ;
While the Truth Cycle
RowNumber = RowNumber + 1 ;
CellValue = Sheet. Cells(RowNumber, ColumnNumber). Value;
If NOT ValueFilled(CellValue) Then
Abort;
endIf;
EndCycle;

Instead of traversing all the rows of the sheet sequentially, you can dump all data into an array and work with him. This approach will be faster when reading a large amount of data:

TotalColumns = Sheet. Cells(1 , 1 ). SpecialCells(11). Column;
TotalRows = Leaf. Cells(1 , 1 ). SpecialCells(11). Row;

Region = Leaf. Range(Sheet. Cells(1, 1), Sheet. Cells(TotalRows,TotalColumns));
Data = Region. Value. Unload();

The table below shows the most popular properties and methods for working with Excel via OLE:

Action Code A comment
Working with the application
Setting application window visibility Excel . Visible= False;
Setting the warning output mode (display/not display) Excel . DisplayAlerts= False;
Closing the application Excel . Quit();
Working with a book
Creating a new book Book = Excel. WorkBooks. Add();
Opening an existing workbook Book = Excel. WorkBooks. Open(FileName);
Saving a book Book . SaveAs(FileName);
Closing the book Book . Close(0);
Working with a sheet
Setting the current sheet Sheet = Book. WorkSheets(SheetNumber);
Setting the name Sheet . Name = Name;
Setting up protection Sheet . Protect();
Removing protection Sheet . UnProtect();
Setting the page orientation Sheet . PageSetup. Orientation = 2; 1 - portrait, 2 - landscape
Setting the left border Sheet . PageSetup. LeftMargin = Excel. CentimetersToPoints(Centimeters);
Setting the upper limit Sheet . PageSetup. TopMargin = Excel. CentimetersToPoints(Centimeters);
Setting the right border Sheet . PageSetup. RightMargin = Excel. CentimetersToPoints(Centimeters);
Setting the lower limit Sheet . PageSetup. BottomMargin = Excel. CentimetersToPoints(Centimeters);
Working with rows, columns, cells
Setting Column Width Sheet . Columns(ColumnNumber). ColumnWidth = Width;
Delete a line Sheet . Rows(RowNumber). Delete();
Removing a column Sheet . Columns(ColumnNumber). Delete();
Delete a cell Sheet . Cells(RowNumber, ColumnNumber). Delete();
Setting the value Sheet . Cells(RowNumber, ColumnNumber). Value = Value;
Merging cells Sheet . Range(Sheet. Cells(RowNumber, ColumnNumber), Sheet. Cells(RowNumber1, ColumnNumber1)). Merge();
Setting the font Sheet . Cells(RowNumber, ColumnNumber). Font. Name = FontName;
Setting the font size Sheet . Cells(RowNumber, ColumnNumber). Font. Size = Font Size;
Setting bold font Sheet . Cells(RowNumber, ColumnNumber). Font. Bold = 1 ; 1 - bold, 0 - normal
Setting italics Sheet . Cells(RowNumber, ColumnNumber). Font. Italic = 1 ; 1 - italic, 0 - normal
Setting the underlined font Sheet . Cells(RowNumber, ColumnNumber). Font. Underline = 2 ; 2 - underlined, 1 - not

In order to find out which property needs to be changed or which method to call, you can use macros Excel. If you record a macro with the required actions, then you can then look at the VBA code of the recorded macro.

Using COMSafeArray

When downloading large amounts of data from 1C to Excel, you can use the object to speed up COMSafeArray. According to the definition from the syntax assistant, COMSafeArray is an object wrapper over a multidimensional array SafeArray from COM. Allows you to create and use SafeArray for exchanging data between COM objects. Simply put, it is an array of values ​​that can be used to exchange between applications using OLE technology.

// Create COMSafeArray
ArrayCom = New COMSafeArray("VT_Variant" , TotalColumns, TotalRows);
// Fill COMSafeArray
For Page = 0 By TotalLines - 1 Cycle
For Number = 0 Total Columns - 1 Cycle
ArrayCom . SetValue(Count, Page, Value);
EndCycle;
EndCycle;
// Assigning an Excel worksheet area to values ​​from COMSafeArray
Sheet . Range(Sheet. Cells(1, 1), Sheet. Cells(TotalRows,TotalColumns)). Value = ArrayCom;

Exchange via ADO

An Excel file, when exchanged via ADO, is a database that can be accessed using SQL queries. Installation of MS Excel is not required, but you must have an ODBC driver with which access will be provided. The ODBC driver used is determined by specifying the connection string to the file. Typically, the required driver is already installed on the computer.

Exchange via ADO is noticeably faster than exchange via OLE, but when uploading, it is not possible to use Excel functionality for designing cells, laying out pages, setting formulas, etc.

Example unloading:


Connection = New COMObject("ADODB.Connection");


Compound . ConnectionString = "

|Data Source=" + FileName + ";
;
Compound . Open(); // Open a connection

// Create a COM object for the command
Command = New COMObject("ADODB.Command");
Team

// Assigning command text to create a table
Team . CommandText = "CREATE TABLE [Sheet1] (Column1 char(255), Column2 date, Column3 int, Column4 float)";
Team . Execute(); // Execute the command

// Assigning command text to add a table row
Team . CommandText = "INSERT INTO [Sheet1] (Column1, Column2, Column3, Column4) values ​​('abvwhere', '8/11/2017', '12345', '12345,6789')";
Command.Execute(); // Execute the command

// Remove the command and close the connection
Command = Undefined;
Compound . Close();
Connection = Undefined;

To create a new sheet and form its structure, you can use objects ADOX.Catalog And ADOX.Table. In this case, the code will look like:

// Create a COM object for working with the book
Book = New COMObject("ADOX.Catalog");
Book . ActiveConnection = Connection;

// Create a COM object to work with the data structure on the sheet
Table = New COMObject("ADOX.Table");
Table . Name = "Sheet1" ;
Table . Columns. Append("Column1", 202);
Table . Columns. Append("Column2", 7);
Table . Columns. Append("Column3", 5);
Table . Columns. Append("Column4", 5);

// Create a sheet with the described structure in the workbook
Book . Tables. Append(Table);
Table = Undefined;
Book = Undefined;

In the above example, in the method

Table . Columns. Append(“Column1”, 202);

the second parameter specifies the column type. The parameter is optional, here are some column type values:

  • 5 - adDouble;
  • 6 - adCurrency;
  • 7 - adDate;
  • 11 - adBoolean;
  • 202 - adVarWChar;
  • 203 - adLongVarWChar.

Example reading:

// Create a COM object for the connection
Connection = New COMObject("ADODB.Connection");

// Set the connection string
Compound . ConnectionString = "
|Provider=Microsoft.ACE.OLEDB.12.0;
|Data Source=" + FileName + ";
|Extended Properties=""Excel 12.0 XML;HDR=YES"";";
Compound . Open(); // Open a connection

// Create a COM object to receive the selection
Select = New COMObject("ADODB.Recordset");
RequestText = "SELECT * FROM [Sheet1$]";

// Execute the request
Sample . Open(QueryText, Connection);

// Bypass the sample result
Not a selection yet. EOF() Loop
Column1 value = Selection. Fields. Item("Column1"). Value ; // Access by column name
Column2Value = Selection. Fields. Item(0). Value; // Access by column index
Sample . MoveNext();
EndCycle;

Sample . Close();
Sample = Undefined;
Compound . Close();
Connection = Undefined;

In the connection string the parameter HDR determines how the first line on the sheet will be perceived. Possible options:

  • YES - the first line is treated as column names. Values ​​can be accessed by name and column index.
  • NO - the first line is treated as data. Values ​​can only be accessed by column index.

These examples only cover a few ADO objects. The ADO object model consists of the following objects:

  • connection;
  • Command;
  • recordset;
  • Record;
  • Fields;
  • Stream;
  • Errors;
  • parameters;
  • Properties.

Upload without programming

To save data from 1C to Excel, it is not always advisable to resort to programming. If in Enterprise mode the user can display the data required for downloading, then they can be saved in Excel without programming.

To save a spreadsheet document (for example, the result of a report), you can call the command Save or Save as… main menu.

In the window that opens, you need to select the directory, name and format of the saved file.

To save data from dynamic lists (for example, a list of items), you must:

  1. Output data to a spreadsheet document using the command More ⇒ List...;
  2. Save the spreadsheet document in the required format.

In 1C there are 2 ways to work with MS Excel files: through a COM object and built-in 1C tools using a spreadsheet document object. Let's look at both of these methods in more detail.

1. Work through a COM object.

This method requires installed MS Excel, and if you are working with a file on the server, then MS Excel must be installed on the server, if on the client, then MS Excel is also required on the client side.

Example (you can see it in text form at the end of the article):

It should be noted that all objects, methods and properties provided by the COM object "Excel.Application" are objects, methods and properties of VBA, the MS Office programming language.

Note:

Sometimes you need to work with an existing template. Then we need to store this template somewhere so that all the necessary users have access to it. However, there is a simpler solution, save the template as a binary layout.

2. Work through Tabular Document 1C.

The 1C spreadsheet document supports the MS Excel format for recording starting from platform 8, but for opening only starting from platform 8.3.6. Moreover, when opened, all sheets are loaded into one spreadsheet document. Since version 8.3.10, when loading, different sheets are loaded as different areas.

An example entry is very simple and does not require special attention:

However, here we have a problem. When recording from 1C in an Excel workbook, the display of sheet names is disabled by default.

This problem can be solved in 2 ways, 1 - in the book itself, enable the display of sheets in the settings (not all users will agree to do this), 2 - do this through a COM object (we again need MS Excel installed).

After this small addition, sheet labels will be visible in the MS Excel file.

Reading MS Excel is not such an easy task, since the read method is only available on the server or thick client. To do this, we need to transfer the MS Excel file to the server.

&OnClient

Procedure CreateDocument()

Exception

EndAttempt;

Book = Excel.WorkBooks.Add(); //Create a new MS Excel workbook

Sheet = Book.WorkSheets.Add(); //Add a sheet

Sheet.Name = "Example from 1C"; //Set the sheet name

Sheet.Cells(1,1).Value = "Let's create a formula";!}

Sheet.Cells(2,1).Value = 1;

Sheet.Cells(2,2).Value = 2;

Sheet.Cells(2,3).Formula = "=A2+B2";

Sheet.Cells(3,1).Value = CurrentDate();

Book.SaveAs("C:\1\Test.xlsx");

Book.Close();

End of Procedure

&On server

Function GetLayoutServer()

Return FormAttributesValue("Object").GetLayout("TemplateForUpload"); //This way we get the external processing layout;

EndFunction

&OnClient

Procedure Work()

Excel = New COMObject("Excel.Application");

Exception

Report("An attempt to connect the Excel component was unsuccessful. Excel may not be installed on this computer!");

EndAttempt;

Layout = GetLayoutServer();

Layout.Write(TemporaryFileName);

Do you have a question or need help from a consultant?

Book = Excel.WorkBooks.Open(TemporaryFileName);

SheetTemplate = Book.WorkSheets(1);

SheetTemplate.Cells(6,1).Value = "Date:";!}

SheetTemplate.Cells(6,2).Value = CurrentDate();

SheetTemplate.NumberFormat = "dd/mm/yy;@"; // Give the date format, this format was obtained by recording a macro in MS Excel

SheetTemplate.Columns("B:B").EntireColumn.AutoFit; // Stretch the column so that the date fits exactly

Book.SaveAs(FileName);

Book.Close();

End of Procedure

&OnClient

End of Procedure

&OnClient

Procedure WriteTabularDocument()

TabularDocument = New TabularDocument();

TabularDocument.Area("R1C1").Text = "Example of a record in MS Excel from 1C";

TabularDocument.Write("C:\1\Test2.xls",TabularDocumentFileType.XLSX);

Excel = New COMObject("Excel.Application");

Excel.WorkBooks.Open("C:\1\Test2.xls");

Excel.Visible = 0;

Excel.ActiveWindow.DisplayWorkbookTabs = 1;

Excel.ActiveWindow.TabRatio = 0.6;

Excel.ActiveWorkbook.Save();

Excel.Application.Quit()

End of Procedure

BinaryData = New BinaryData("C:\1\test2.xlsx");

Address=PlaceInTemporaryStorage(BinaryData,ThisForm.UniqueIdentifier) ​​;

TabularDocument = UploadOnServer(Address);

TabularDocument.Show();

End of Procedure

&On server

Function UploadOnServer(Address)

TemporaryFileName = GetTemporaryFileName("xlsx");

FileData = GetFromTemporaryStorage(Address);

FileData.Write(TemporaryFileName);

TabularDocument = New TabularDocument();

return TabularDocument;