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