Desktop version

Main > Forum > 1C:Enterprise Platform > Studying 1C:Enterprise platform > Printing of TabularRows

Forum

Search UsersRules
Printing of TabularRows
#1
Interested
Points:: 0
Joined:: Nov 10, 2011

Hi,

I need to show on the print form TabularRows. The button "print" ist in the document form.

Here is the code:

Code
&AtClient
Procedure Print(Command)
   Spreadsheet = New SpreadsheetDocument;

   PrintAtServer(Spreadsheet);
   
   Spreadsheet.Show();
   
EndProcedure


and

Profile
#2
Interested
Points:: 0
Joined:: Nov 10, 2011

Code
&AtServer
Procedure PrintAtServer(Spreadsheet)
   
   
   Template = Documents.SalesQuote.GetTemplate("PF_MXL_SalesQuote");
   TemplateArea = Template.GetArea("Header");
   TemplateArea.Parameters.ThemBill = Object.CompanyAddress;
   TemplateArea.Parameters.Date = Object.Date;
   TemplateArea.Parameters.Number = "AnbotsNr.: " + Object.Number;
   TemplateArea.Parameters.Subject = Object.Subject;

   
   Spreadsheet.Put(TemplateArea);
   
   TemplateArea =     Template.GetArea("Salutation");
            
   TemplateArea.Parameters.TextBausteinBefore = GeneralFunctions.GetTextBaustein(Object.Ref);

   Spreadsheet.Put(TemplateArea);

   

EndProcedure

Profile
#3
Interested
Points:: 0
Joined:: Nov 10, 2011

and in GeneralFunctions:

Code
Function GetTextBaustein(Ref) Export
   
      
   Query = New Query();
    Query.Text = "SELECT
                      | SalesQuote.Ref,
                      |   SalesQuote.TextBuilding.(
                      |//-------------------------------------
                      |      TextBuildingName,
                      |      Textbaustein,
                      |      BeforePositions
                      |   )
                      |FROM
                      |   Document.SalesQuote AS SalesQuote
                      |WHERE
                      |   SalesQuote.Ref IN(&Ref)";
                  
                 Query.SetParameter("Ref", Ref);
                 Selection = Query.Execute().Choose();
                       
                                          
               SelectionTextBuilding = Selection.TextBuilding.Choose();

               While SelectionTextBuilding.Next() Do
     

        TextBaustein = "Text"; // Just for test purposes
     

     EndDo; 

         
   Return TextBaustein;
      
EndFunction

Profile
#4
Interested
Points:: 0
Joined:: Nov 10, 2011

But I get an error:

Wert ist nicht vom Typ "Objekt" (Choose) -  Value is not of type "Object"
SelectionTextBuilding = Selection.TextBuilding.Choose();

What's wrong?

Thanks a lot in advance.

Profile
#5
Interested
Points:: 0
Joined:: Nov 10, 2011

Sorry for writing in several messages, it didn't work somehow to create a complete post

Profile
#6
Guest
Points::
Joined::

You need to go next first to select something from subtable.

Profile
#7
Interested
Points:: 0
Joined:: Nov 10, 2011

Thanks, Timofey! But I tried several variation and it still doesn't work :( Maybe you can write how I should change the code?

Profile
#8
Guest
Points::
Joined::

Here is an example:

Code
Query = New Query;
Query.Text = 
   "SELECT
   |   Kits.Ref,
   |   Kits.Description,
   |   Kits.Parts.(
   |      Item,
   |      Quantity
   |   )
   |FROM
   |   Catalog.Kits AS Kits";

QueryResult = Query.Execute();

SelectionDetailRecords = QueryResult.Choose();

While SelectionDetailRecords.Next() Do
   
   Parts = SelectionDetailRecords.Parts.Choose();
   While Parts.Next() Do
      UserMessage = New UserMessage;
      UserMessage.SetData(SelectionDetailRecords.Ref.GetObject());
      UserMessage.Text = Parts.Item + " x " + Parts.Quantity;
      UserMessage.Message();
   EndDo;
   
EndDo;

Profile
#9
Interested
Points:: 0
Joined:: Nov 10, 2011

Thanks a lot! It works! :)

Profile
#10
Active user
Points:: 0
Joined:: Nov 3, 2011

Note that in 1C:Enterprise 8.3.4 Choose() was renamed to Select() to match the SELECT query keyword.

Profile
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)



© 1C LLC. All rights reserved
1C Company respects the privacy of our customers and visitors
to our Web-site.