Telerik Forums
Reporting Forum
1 answer
102 views
Hi 
I want to Sum on conditional basis on string field just like this If SalesTypes = "Ledger" then add Cash in Hand field 
or Sum(IIF(Fields.SalesType=="Ledger",Field.Cashinhand,0)))
So please help me out I have read so many article but didn't find any solution.
Todor
Telerik team
 answered on 23 Sep 2020
3 answers
445 views

I want to print Detail Section in the first page, but it could not, all components's keep together are setted false, but it's no effort, 

And the Catogary Name does not print on every Page.

My demo code is bellow:

<?xml version="1.0" encoding="utf-8"?>
<Report Width="18.1cm" Name="Report1" xmlns="http://schemas.telerik.com/reporting/2020/1.0">
  <DataSources>
    <JsonDataSource Name="jsonDataSource1">
      <Source>
        <String>Ww0KeyJOYW1lIjoiVEVTVCIsICJBbW91bnQiOiAxfSwNCnsiTmFtZSI6IlRFU1QiLCAiQW1vdW50IjogMn0sDQp7Ik5hbWUiOiJURVNUIiwgIkFtb3VudCI6IDN9LA0KeyJOYW1lIjoiVEVTVCIsICJBbW91bnQiOiA0fSwNCnsiTmFtZSI6IlRFU1QiLCAiQW1vdW50IjogNX0sDQp7Ik5hbWUiOiJURVNUIiwgIkFtb3VudCI6IDZ9LA0KeyJOYW1lIjoiVEVTVCIsICJBbW91bnQiOiA3fSwNCnsiTmFtZSI6IlRFU1QiLCAiQW1vdW50IjogOH0sDQp7Ik5hbWUiOiJURVNUIiwgIkFtb3VudCI6IDl9LA0KeyJOYW1lIjoiVEVTVCIsICJBbW91bnQiOiAxMH0sDQp7Ik5hbWUiOiJURVNUIiwgIkFtb3VudCI6IDExfSwNCnsiTmFtZSI6IlRFU1QiLCAiQW1vdW50IjogMTJ9LA0KeyJOYW1lIjoiVEVTVCIsICJBbW91bnQiOiAxM30sDQp7Ik5hbWUiOiJURVNUIiwgIkFtb3VudCI6IDE0fSwNCnsiTmFtZSI6IlRFU1QiLCAiQW1vdW50IjogMTV9LA0KeyJOYW1lIjoiVEVTVCIsICJBbW91bnQiOiAxNn0sDQp7Ik5hbWUiOiJURVNUIiwgIkFtb3VudCI6IDE3fSwNCnsiTmFtZSI6IlRFU1QiLCAiQW1vdW50IjogMTh9LA0KeyJOYW1lIjoiVEVTVCIsICJBbW91bnQiOiAxOX0sDQp7Ik5hbWUiOiJURVNUIiwgIkFtb3VudCI6IDIwfQ0KXQ==</String>
      </Source>
    </JsonDataSource>
  </DataSources>
  <Items>
    <DetailSection KeepTogether="False" Height="1.217cm" Name="detailSection1">
      <Items>
        <List Width="17.905cm" Height="1.217cm" Left="0cm" Top="0cm" KeepTogether="False" Name="list1">
          <Body>
            <Cells>
              <TableCell RowIndex="0" ColumnIndex="1" RowSpan="1" ColumnSpan="1">
                <ReportItem>
                  <Panel Width="16.2cm" Height="1.217cm" Left="0cm" Top="0cm" KeepTogether="False" Name="panel1">
                    <Items>
                      <Table DataSourceName="jsonDataSource1" Width="16.2cm" Height="1.217cm" Left="0cm" Top="0cm" KeepTogether="False" Name="table1">
                        <Body>
                          <Cells>
                            <TableCell RowIndex="0" ColumnIndex="2" RowSpan="1" ColumnSpan="1">
                              <ReportItem>
                                <TextBox Width="5.4cm" Height="0.608cm" Left="0cm" Top="0cm" Name="textBox6">
                                  <Style>
                                    <BorderStyle Top="Solid" Bottom="Solid" Left="Solid" Right="Solid" />
                                    <BorderColor Top="Black" Bottom="Black" Left="Black" Right="Black" />
                                    <BorderWidth Top="1pt" Bottom="1pt" Left="1pt" Right="1pt" />
                                  </Style>
                                </TextBox>
                              </ReportItem>
                            </TableCell>
                            <TableCell RowIndex="0" ColumnIndex="0" RowSpan="1" ColumnSpan="1">
                              <ReportItem>
                                <TextBox Width="5.4cm" Height="0.608cm" Left="8.095cm" Top="0.6cm" Value="= Fields.Name" Name="textBox8" StyleName="">
                                  <Style>
                                    <BorderStyle Top="Solid" Bottom="Solid" Left="Solid" Right="Solid" />
                                  </Style>
                                </TextBox>
                              </ReportItem>
                            </TableCell>
                            <TableCell RowIndex="0" ColumnIndex="1" RowSpan="1" ColumnSpan="1">
                              <ReportItem>
                                <TextBox Width="5.4cm" Height="0.608cm" Left="8.095cm" Top="0.6cm" Value="= Fields.Amount" Name="textBox2" StyleName="">
                                  <Style>
                                    <BorderStyle Top="Solid" Bottom="Solid" Left="Solid" Right="Solid" />
                                  </Style>
                                </TextBox>
                              </ReportItem>
                            </TableCell>
                          </Cells>
                          <Columns>
                            <Column Width="5.4cm" />
                            <Column Width="5.4cm" />
                            <Column Width="5.4cm" />
                          </Columns>
                          <Rows>
                            <Row Height="0.608cm" />
                          </Rows>
                        </Body>
                        <Corner />
                        <Style Visible="True">
                          <BorderStyle Top="Solid" Bottom="Solid" Left="Solid" Right="Solid" />
                          <BorderColor Top="Black" Bottom="Black" Left="Black" Right="Black" />
                          <BorderWidth Top="1pt" Bottom="1pt" Left="1pt" Right="1pt" />
                        </Style>
                        <RowGroups>
                          <TableGroup Name="detailTableGroup">
                            <Groupings>
                              <Grouping />
                            </Groupings>
                          </TableGroup>
                        </RowGroups>
                        <ColumnGroups>
                          <TableGroup Name="tableGroup">
                            <ReportItem>
                              <TextBox Width="5.4cm" Height="0.609cm" Left="0cm" Top="0cm" Value="Name" Name="textBox1">
                                <Style>
                                  <BorderStyle Top="Solid" Bottom="Solid" Left="Solid" Right="Solid" />
                                  <BorderColor Top="Black" Bottom="Black" Left="Black" Right="Black" />
                                  <BorderWidth Top="1pt" Bottom="1pt" Left="1pt" Right="1pt" />
                                </Style>
                              </TextBox>
                            </ReportItem>
                          </TableGroup>
                          <TableGroup Name="tableGroup1">
                            <ReportItem>
                              <TextBox Width="5.4cm" Height="0.609cm" Left="0cm" Top="0cm" Value="Amount" Name="textBox3">
                                <Style>
                                  <BorderStyle Top="Solid" Bottom="Solid" Left="Solid" Right="Solid" />
                                  <BorderColor Top="Black" Bottom="Black" Left="Black" Right="Black" />
                                  <BorderWidth Top="1pt" Bottom="1pt" Left="1pt" Right="1pt" />
                                </Style>
                              </TextBox>
                            </ReportItem>
                          </TableGroup>
                          <TableGroup Name="tableGroup2">
                            <ReportItem>
                              <TextBox Width="5.4cm" Height="0.609cm" Left="0cm" Top="0cm" Name="textBox5">
                                <Style>
                                  <BorderStyle Top="Solid" Bottom="Solid" Left="Solid" Right="Solid" />
                                  <BorderColor Top="Black" Bottom="Black" Left="Black" Right="Black" />
                                  <BorderWidth Top="1pt" Bottom="1pt" Left="1pt" Right="1pt" />
                                </Style>
                              </TextBox>
                            </ReportItem>
                          </TableGroup>
                        </ColumnGroups>
                      </Table>
                    </Items>
                  </Panel>
                </ReportItem>
              </TableCell>
              <TableCell RowIndex="0" ColumnIndex="0" RowSpan="1" ColumnSpan="1">
                <ReportItem>
                  <TextBox Width="1.705cm" Height="1.217cm" Left="0cm" Top="0cm" KeepTogether="False" Value="Catogary Name" Name="textBox7" StyleName="">
                    <Style TextAlign="Center" VerticalAlign="Middle" />
                  </TextBox>
                </ReportItem>
              </TableCell>
            </Cells>
            <Columns>
              <Column Width="1.705cm" />
              <Column Width="16.2cm" />
            </Columns>
            <Rows>
              <Row Height="1.217cm" />
            </Rows>
          </Body>
          <Corner />
          <Style>
            <BorderStyle Top="Solid" Bottom="Solid" Left="Solid" Right="Solid" />
            <BorderColor Top="Black" Bottom="Black" Left="Black" Right="Black" />
            <BorderWidth Top="1pt" Bottom="1pt" Left="1pt" Right="1pt" />
          </Style>
          <RowGroups>
            <TableGroup Name="DetailGroup">
              <Groupings>
                <Grouping />
              </Groupings>
            </TableGroup>
          </RowGroups>
          <ColumnGroups>
            <TableGroup Name="group" />
            <TableGroup Name="ColumnGroup" />
          </ColumnGroups>
        </List>
      </Items>
    </DetailSection>
    <ReportHeaderSection KeepTogether="False" Height="0.5cm" Name="reportHeaderSection1">
      <Items>
        <TextBox Width="3cm" Height="0.5cm" Left="7.7cm" Top="0cm" Value="TEST" Name="textBox14" />
      </Items>
    </ReportHeaderSection>
  </Items>
  <PageSettings PaperKind="Custom" PaperSize="210mm, 60mm" Landscape="False" ContinuousPaper="False">
    <Margins>
      <MarginsU Left="1cm" Right="1cm" Top="1cm" Bottom="1cm" />
    </Margins>
  </PageSettings>
  <StyleSheet>
    <StyleRule>
      <Style>
        <Padding Left="2pt" Right="2pt" />
      </Style>
      <Selectors>
        <TypeSelector Type="TextItemBase" />
        <TypeSelector Type="HtmlTextBox" />
      </Selectors>
    </StyleRule>
  </StyleSheet>
</Report>
Todor
Telerik team
 answered on 23 Sep 2020
1 answer
106 views
Hi, I have a graph(stacked bars type) that is for showing departments. At the moment its on one page, its height is enough to display 40 departments, however if the data includes more than 40 the graph will still just be one page, not displaying the remaining data. 

Is it possible to make the graph extend onto the next page/grow untill it has displayed all the data? 
If no, is it possible to program the height somehow through code (so i could calculate the correct height based on the data it will receive)?
Todor
Telerik team
 answered on 21 Sep 2020
2 answers
197 views
Hi, I have a problem formatting the report. I set up column groups, but the next group always appears below the previous one. I attach picture for illustration. Is there any way to display the data side by side? Thank you
Vít
Top achievements
Rank 1
 answered on 19 Sep 2020
1 answer
206 views

Can i set any custom message for parameter. below message is displayed by default.

 

Missing or Invalid parameter value. Please input valid data for all parameters.

Is there any option to give a custom message.

 

Regards

Prakash

 

Todor
Telerik team
 answered on 17 Sep 2020
7 answers
2.7K+ views

Hi to all,

I'm trying to create a solution console that it has generate a DOCX file from my report.

I'm using this code, but on row 34 it gives me an error "DOCX rendering format is not available."

I have already add these dll:

  • DocumentFormat.OpenXml
  • Telerik.Reporting
  • Telerik.Reporting.OpenXmlRendering
01.public class ReportHelper
02.{
03.    public static Bundle SaveAsWord(string fileName, Bundle pBundle)
04.    {
05.        Bundle bundle = new Bundle();
06. 
07.        try
08.        {
09.            //Create new CultureInfo
10.            var cultureInfo = new System.Globalization.CultureInfo(pBundle.Get(2).ToString());
11. 
12.            // Set the language for static text (i.e. column headings, titles)
13.            System.Threading.Thread.CurrentThread.CurrentUICulture = cultureInfo;
14. 
15.            // Set the language for dynamic text (i.e. date, time, money)
16.            System.Threading.Thread.CurrentThread.CurrentCulture = cultureInfo;
17. 
18.            Telerik.Reporting.Processing.ReportProcessor reportProcessor = new Telerik.Reporting.Processing.ReportProcessor();
19. 
20.            // set any deviceInfo settings if necessary
21.            System.Collections.Hashtable deviceInfo = new System.Collections.Hashtable();
22.             
23. 
24.            Telerik.Reporting.TypeReportSource typeReportSource = new Telerik.Reporting.TypeReportSource();
25. 
26.            // reportName is the Assembly Qualified Name of the report
27.            typeReportSource.TypeName = "MyReportName";
28.            typeReportSource.Parameters.Add("Par1", pBundle.Get(1).ToString());
29.            typeReportSource.Parameters.Add("Par2", pBundle.Get(3).ToString());
30.            typeReportSource.Parameters.Add("Par3", pBundle.Get(4).ToString());
31.            typeReportSource.Parameters.Add("Par4", pBundle.Get(5).ToString());
32.            typeReportSource.Parameters.Add("Par5", pBundle.Get(6).ToString());
33. 
34.            Telerik.Reporting.Processing.RenderingResult result = reportProcessor.RenderReport("DOCX", typeReportSource, deviceInfo);
35. 
36.            //string fileName = result.DocumentName + "." + result.Extension;
37.            string path = System.IO.Path.GetTempPath();
38.            string filePath = System.IO.Path.Combine(path, fileName);
39. 
40.            using (System.IO.FileStream fs = new System.IO.FileStream(filePath, System.IO.FileMode.Create))
41.            {
42.                fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);
43.            }
44. 
45.            bundle.Add(1, true);
46.            bundle.Add(2, filePath);
47.        }
48.        catch (Exception ex)
49.        {
50.            bundle.Add(1, false);
51.            bundle.Add(2, ex.Message);
52.            bundle.Add(3, ex.StackTrace.ToString());
53.        }
54. 
55.        return bundle;
56.    }
57.}
Neli
Telerik team
 answered on 17 Sep 2020
3 answers
474 views

I want to be able to stop the execution of the ReportProcessor.PrintReport() and throw a custom error when the printer is unavailable (e.g: disconnected from the server) because instead of doing that the method is trying to find the printer and it freezes. if that's not possible a way to exit the method (timer?) would be good as well.

 

Regards,

 

Gaston.

 

Todor
Telerik team
 answered on 16 Sep 2020
3 answers
343 views

Hello

 

I am trying to integrate reports in my Winform application but visible I am missing a step:

My application is a Winform application using an EntityFramework to manage the data (stored in y SQLServer database)

I have created a form with a Reportviewer in my project

In visual studio I have created a report (named rptStartList.vb) that has the datasource : rptEntityDataSource [Telerik.Reporting.EntityDataSource]
and the entityDatasource as a proper connectionstring, context ad contextdatamember. The report displays correctly the underlying data in preview

Now I need to "associate" this report to the report Viewer. I have read everything I found, but have failed to understand, in particular I do not understand how to

"Add reference to the class library that contains your reports in the windows form application." found in : https://docs.telerik.com/reporting/winforms-report-viewer-manual-setup

and how to create this class library and what is in it

Can you guide me on how to procee, clearly I am missing a, probably simple, step ....

Thanks in advance

P.S. should you have a complete sample application with the same environment I would appreciate greatly

Neli
Telerik team
 answered on 16 Sep 2020
2 answers
1.1K+ views
Hi,

I have a table in report header which displays summary data.
I want the table not to be disabled when there is no summary data.
I have created a binding on table with [Property path = Visible] and [Expression =IIF(Count(1)>0,True,False)].
 It gives me the below error when i run the report.
An error has occurred while processing Table 'table1': Aggregate node 'Count(Const(1))' not found. 

I think the expression value is incorrect. What expression will return me the rowcount. so that if the rowcount = 0 then i can make visible property = false.
Your help will be appreciated.

Thanks.
Srinath. 
Richard
Top achievements
Rank 1
 answered on 15 Sep 2020
8 answers
911 views
Hi! Is there a sample that adds Export to XML from the report export menu? Thanks.
Eric R | Senior Technical Support Engineer
Telerik team
 answered on 15 Sep 2020
Top users last month
Tien
Top achievements
Rank 1
Iron
Krasimir
Top achievements
Rank 3
Bronze
Iron
Iron
Cedar
Top achievements
Rank 1
Iron
Emil
Top achievements
Rank 1
Iron
Kyle Watson
Top achievements
Rank 1
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?