Desktop version

Main > Forum > 1C:Enterprise Platform > Studying 1C:Enterprise platform > Report in 1C

Forum

Search UsersRules
Report in 1C
#1
Active user
Points:: 0
Joined:: Jan 14, 2013

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")?

Profile
#2
Active user
Points:: 0
Joined:: Apr 18, 2012

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.

Profile
#3
Active user
Points:: 0
Joined:: Jan 14, 2013

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.

Profile
#4
Active user
Points:: 0
Joined:: Apr 18, 2012

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.

Profile
#5
Active user
Points:: 0
Joined:: Jan 14, 2013

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.

Profile
#6
Active user
Points:: 0
Joined:: Apr 18, 2012

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;

Profile
#7
Active user
Points:: 0
Joined:: Jan 14, 2013

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

Profile
#8
Active user
Points:: 0
Joined:: Apr 18, 2012

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;

Profile
#9
Active user
Points:: 0
Joined:: Jan 14, 2013

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.

Profile
#10
Active user
Points:: 0
Joined:: Apr 18, 2012

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.

Profile
#11
Active user
Points:: 0
Joined:: Jan 14, 2013

Hi Alexei Khatin!

Thanks you.

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.