Report in 1C

Understanding basics of 1C:Enterprise platform. To start working with 1C:Enterprise platform visit Getting started page

#1
People who like this:0Yes/0No
Active user
Rating: 2
Joined: Jan 14, 2013
Company:

Hello everyone.
I wish everyone a few questions to help.
1. I have one more page report, plus I want to report the total number of column 1 at the end of each page when printing?
2.Tren print my report can count the number of lines (including the case of regime "wrap")?

 
#2
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Apr 18, 2012
Company:

Hi.
1. The easiest way to print total number of pages is using Header and Footer.
Here is example:

Code
SpreadsheetDocument.Footer.Enabled = True;
SpreadsheetDocument.Footer.LeftText = "Page #[&PageNumber] of [&PagesTotal]";


2. Unfortunately, I can't understand your second question. Please explain in more details.

 
#3
People who like this:0Yes/0No
Active user
Rating: 2
Joined: Jan 14, 2013
Company:

Hi Alexei Khatin!
Thanks for answer of you, But you don't understand of my quest.
1. Exp :  I have got column "number" on reports and it have got 3 pages. When i printed it, i want to print Sum(number) of each page bottom of each page.
2. Exp picture : i have got 4 pages, if not including the case of regime "wrap" i can count row by code ok, but it use "wrap" i can't count row.

 
#4
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Apr 18, 2012
Company:

1. I hope this code could help you

Code
SpreadsheetDocument.TopMargin = 10;
SpreadsheetDocument.BottomMargin = 10;
SpreadsheetDocument.RightMargin = 10;
SpreadsheetDocument.LeftMargin = 10;
SpreadsheetDocument.FitToPage = False;
SpreadsheetDocument.PrintScale = 100;

Template = Reports.Report1.GetTemplate("Template");
AreaRow = Template.GetArea("Row");
AreaFooter = Template.GetArea("Footer");

CheckArray = New Array();
CheckArray.Add(AreaRow);
CheckArray.Add(AreaFooter);

Sum = 0;
For i = 1 To 200 Do
   Sum = Sum + i;
   
   AreaRow.Parameters.Text = i;
   SpreadsheetDocument.Put(AreaRow);
   
   If Not SpreadsheetDocument.CheckPut(CheckArray) Then
      AreaFooter.Parameters.Sum = Sum;
      SpreadsheetDocument.Put(AreaFooter);
      Sum = 0;
   EndIf
EndDo;

If Sum <> 0 Then
   AreaFooter.Parameters.Sum = Sum;
   SpreadsheetDocument.Put(AreaFooter);
EndIf;


2. I still can't understand.

 
#5
People who like this:0Yes/0No
Active user
Rating: 2
Joined: Jan 14, 2013
Company:

Hi Alexei Khatin.

1. This example is useful for me.
2. It's the same as '1', i need count row in a page.
Thanks you.

 
#6
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Apr 18, 2012
Company:

Look at the varaiable "RowsCount". Is it what you need?

Code
Sum = 0;
RowsCount = 0;

For i = 1 To 200 Do
   Sum = Sum + i;
   
   AreaRow.Parameters.Text = i;
   SpreadsheetDocument.Put(AreaRow);
   RowsCount = RowsCount + 1;
   
   If Not SpreadsheetDocument.CheckPut(CheckArray) Then
      AreaFooter.Parameters.Sum = Sum;
      AreaFooter.Parameters.RowsCount = RowsCount;
      SpreadsheetDocument.Put(AreaFooter);
      
      Sum = 0;
      RowsCount = 0;
   EndIf
EndDo;

If Sum <> 0 Then
   AreaFooter.Parameters.Sum = Sum;
   AreaFooter.Parameters.RowsCount = RowsCount;
   SpreadsheetDocument.Put(AreaFooter);
EndIf;

Edited: Alexei Khatin - May 25, 2016 05:39 AM
 
#7
People who like this:0Yes/0No
Active user
Rating: 2
Joined: Jan 14, 2013
Company:

Hi Alexei Khatin.
I've been tried, it's ok. But it not count true row.
Thanks you.

Edited: P& A - May 25, 2016 08:55 PM
 
#8
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Apr 18, 2012
Company:

Hi.
This must count all rows including header.

Code
Sum = 0;
PreviousRowsCount = 0;

For i = 1 To 200 Do
   Sum = Sum + i;
   
   AreaRow.Parameters.Text = i;
   SpreadsheetDocument.Put(AreaRow);
   
   If Not SpreadsheetDocument.CheckPut(CheckArray) Then
      CurrentRowCount = SpreadsheetDocument.TableHeight + AreaFooter.TableHeight - PreviousRowsCount;
      PreviousRowsCount = SpreadsheetDocument.TableHeight + AreaFooter.TableHeight;
      AreaFooter.Parameters.Sum = Sum;
      AreaFooter.Parameters.RowsCount = CurrentRowCount;
      SpreadsheetDocument.Put(AreaFooter);
      
      Sum = 0;
      RowsCount = 0;
   EndIf
EndDo;

If Sum <> 0 Then
   CurrentRowCount = SpreadsheetDocument.TableHeight + AreaFooter.TableHeight - PreviousRowsCount;
   PreviousRowsCount = SpreadsheetDocument.TableHeight + AreaFooter.TableHeight;
   AreaFooter.Parameters.Sum = Sum;
   AreaFooter.Parameters.RowsCount = CurrentRowCount;
   SpreadsheetDocument.Put(AreaFooter);
EndIf;

 
#9
People who like this:0Yes/0No
Active user
Rating: 2
Joined: Jan 14, 2013
Company:

Hi Alexei Khatin.
This ex not count true row if row have got properties text placement is Wrap.
Ex : with picture i sent, we see 3 row in cell but code has got 1 row.

 
#10
People who like this:0Yes/0No
Active user
Rating: 4
Joined: Apr 18, 2012
Company:

Hi.

I realized your problem.
Platform has't any useful features for your case, so you must calculate text wrap manually.
It's easier if you use fixed-width font, you can see cell width in symbols in designer, calculate how many words  cell can contain in one line and get cell height. Otherwise you need to calculate width for all symbols for required font, is's a very complicated algorithm.

 
#11
People who like this:0Yes/0No
Active user
Rating: 2
Joined: Jan 14, 2013
Company:

Hi Alexei Khatin!

Thanks you.

 
Subscribe
Users browsing this topic (guests: 1, registered: 0, hidden: 0)
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.