Decoding a cell in a spreadsheet document 1s 8.2

Question: Please tell me how to do the following.

I have a query result displayed in a spreadsheet document, and there is a transcript for the cell.

I want that when you double click on a cell, a procedure is executed that, for example, launches a report on decrypting the cell.

Answer: Decodings are standard and non-standard.

I) Standard:

can be used both directly in a spreadsheet document and in a TabularDocumentField object (i.e. a spreadsheet document placed not in a separate window, but directly on a form).

For Decryption to work, 3 conditions must be met:

1) For cell spreadsheet document, from which we want to call Decryption, the Decryption Parameter property must be set. For example, we want to double-click on the cell with the name of the counterparty to open the form of the Counterparty directory element, so that we can clarify some data that is not displayed in the report. Set the Decryption Parameter property to some value, for example, Counterparty Decryption.

2) In the process of outputting layout areas to the resulting spreadsheet document, you MUST ASsign a value to the decryption parameter the right type, For example:

Code 1C v 8.x TabDoc = New TabularDocument;
Selection = Directories.Accounts.Select();



// .................................................
Area.Parameters.Account Decryption = Selection.Link;
TabDoc.Output(Area);
EndCycle;

3) It must be ensured that editing a cell with a transcript is prohibited, i.e. need to be specified

TabDoc.ViewOnly = True;

otherwise, despite the promising appearance of the cursor, when you hover over a cell, you can click on it as much as you like, but nothing will happen.

II) Non-standard:

By double-clicking on the cell with the transcript, you can call your procedure. To implement this, several conditions must be met:

1) The output of a spreadsheet document must be carried out into the TabularDocumentField object;

2) The value of the cell property Decryption Parameter must be assigned, for example, Account Decryption.

3) The decryption parameter Counterparty Decryption is assigned to the List of Values, or more often the Structure, filled in with the required values ​​when generating the spreadsheet document. In particular, the name of the standard configuration report and parameters that need to be specified in the report form, for example, date period, account number, etc., can be transmitted. And then this report is called as a procedure.

4) For the TabularDocumentField object, the ViewOnly property must be set to True.

5) The user procedure code is placed in the procedure

Code 1C v 8.x Tabular Document Field 1Decryption Processing(Element, Decryption, StandardProcessing)
// the first line in it should be like this:
StandardProcessing = False;

I'll bring you small example, which opens a subordinate directory for the “clicked” counterparty.

Code 1C v 8.x Procedure ButtonGeneratePress(Button)
Counterparties = Directories. Counterparties;
Selection = Accounts.Select();
Tab = FormElements.TabularDocumentField1;
Layout = GetLayout("Layout");
While Select.Next() Loop
If Sample.ThisGroup = False Then
Area = Layout.GetArea("String");
Area.Parameters.Account = Selection.Name;
.................................................................................................
StructureDecryption = new Structure;
Decryption Structure.Insert("Accounter",Selection.Link);
Decryption Structure.Insert(".......",.........);
.........................................................................
Area.Parameters.Account Decryption = Decryption Structure;
Form Elements.TabularDocumentField1.Output(Area);
Otherwise
Continue;
endIf;
EndCycle;
Form Elements.TabularDocumentField1.ViewOnly = True;
End of Procedure

Procedure TabularDocumentField1DecryptionProcessing(Element,Decryption,StandardProcessing)
StandardProcessing = False;
Agreements = Directories.Agreements.GetListForm();
Agreements.ParameterSelectionByOwner = Explanation.Counterparty;
Agreements.Open();
End of Procedure

In this lesson we will learn how to create table layouts in 1C, which can later be used for .

For example, how I created the layouts for .

I went into the processing form and went to the "Layouts" tab:

The spreadsheet document editor opens:

In many ways, working in an editor is similar to working in Excel program, but there are some features that I would like to highlight.

What do I mean by area? These are several lines and several cells, in general, any part of a spreadsheet document that can be selected by us using left button mice.

Here is a highlighted area of ​​two lines:

And here is a selected area of ​​2 columns:

Now we will select the area at the intersection of the first two rows and the first two columns:

So here it is. If we were able to select the area we need, then by clicking on it right click and by selecting the “Properties” item, we can assign it a name by which we will access it from our code, creating a printed form:

This is a basic skill that we must master in order to be able to make table layouts.

How to view already assigned names

Let's see what names are already assigned to the areas in the layout?

To do this, select from the configurator menu:

Here is our newly designated “Head” area:

And if we now select it in the dialog and click “Select”, then the corresponding one will be selected in the editor. cell area:

How to set the scope parameter

Often, when forming a printed area, you need to do more than simply remove the area from the layout. You also need to fill in certain cells with certain parameters.

We set these parameters for the area and set values automatically fall into the required cells.

To do this, in the properties of the cell we need (where the parameter value will be displayed)...

We indicate the value “Parameter” in the “Filling” field, and in the “Parameter” field we write the name by which we will access this parameter from the code:

If you specify not “Parameter” in the filling, but “Template”, then you can specify some text (template) in the cell itself using the parameter name in square brackets:

In this case, the parameter name (and its position in the template) is indicated in square brackets.

How to set the decryption parameter?

The name of the decryption parameter is set in the same cell properties:

Later, from the code, we will assign this parameter (named “Nomenclature Decoding”) the required value (a link to the nomenclature element).

And when the user double-clicks on this cell, the value assigned to the decryption parameter will open (in this case, the item item form will open).

Further guidance

We've covered the necessary basics. Now examine carefully.

Download this database too. in it the processing "ProcessingForTesting".

Its layouts have tabular options. Explore them as thoroughly as possible, relying on the techniques that we discussed just above.