Posted 22 January 2026, 11:53 am EST
Hi,
Migrate from 2010v1 to 2025v2 399 in ASP.NET WebForms NET Framework 4.8.1.
Using C1ReportViewer from C1.Web.Wijmo.Controls.48.dll
Changes C1WebReport to C1ReportViewer control
<asp:LinkButton ID="btnExport" Visible="true" runat="server" OnClick="btnExport_Click">
<asp:Label ID="lblExport" runat="server" CssClass="XLS"></asp:Label>
</asp:LinkButton>
<asp:LinkButton ID="btnExportPDF" Visible="true" runat="server" OnClick="btnExportPDF_Click">
<asp:Label ID="lblExportPDF" runat="server" CssClass="PDF"></asp:Label>
</asp:LinkButton>
<cc9:C1WebReport ID="C1WebReport" runat="server"
Visible="False" Height="287px"
NavigationBar-HasExportButton="True"
ImageRenderMethod="HttpHandler">
<NavigationBar Style-BackColor="Control"></NavigationBar>
</cc9:C1WebReport>
How-to use XLSX, not XLS, and PDF?
public void showReport(bool exportsXls = true)
{
DataTable mainTable = _dataSources.Tables["MAIN_TABLE_USERS_CONFIGURATOR"];
using (IReportsService reportService = new ReportsService())
{
ReportHelper.ExportUsersDetail(C1WebReport, reportService, LoggedUser, mainTable, exportsXls);
}
UpdatePanelReport.Update();
}
Whats about for new ReportView:
- ReportSource for xml file ?
Report.Fields?
Report.C1Document.PageLayout.PageSettings
Report.DataSource.Recordset?
report.ExportFolder =
report.Export(ExportFormatsEnum.PDF);
report.Export(ExportFormatsEnum.XLS);
public static void ExportUsersDetail(C1WebReport report, IReportsService reportService, SepUser loggedUser, DataTable users, bool exportXls)
{
try
{
report.ReportSource.FileName = string.Format("{0}/{1}/Configuration/UsersExport.xml",
HttpContext.Current.Request.PhysicalApplicationPath,
GenericService.Instance.GetConfigurationParameter(ConfigurationParamType.ReportsPath));
report.ReportSource.ReportName = "report";
report.Report.Fields["logo"].Picture = string.Format("{0}/{1}",
HttpContext.Current.Request.PhysicalApplicationPath,
GenericService.Instance.GetConfigurationParameter(ConfigurationParamType.LogoPath));
report.Report.Fields["logo"].PictureScale = C1.C1Report.PictureScaleEnum.Scale;
report.Report.C1Document.PageLayout.PageSettings.TopMargin = new Unit(Convert.ToDouble(GenericService.Instance.GetConfigurationParameter(ConfigurationParamType.ReportsTopMargin)), UnitTypeEnum.Mm);
report.Report.C1Document.PageLayout.PageSettings.BottomMargin = new Unit(Convert.ToDouble(GenericService.Instance.GetConfigurationParameter(ConfigurationParamType.ReportsBottomMargin)), UnitTypeEnum.Mm);
report.Report.C1Document.PageLayout.PageSettings.LeftMargin = new Unit(Convert.ToDouble(GenericService.Instance.GetConfigurationParameter(ConfigurationParamType.ReportsLeftMargin)), UnitTypeEnum.Mm);
report.Report.C1Document.PageLayout.PageSettings.RightMargin = new Unit(Convert.ToDouble(GenericService.Instance.GetConfigurationParameter(ConfigurationParamType.ReportsRightMargin)), UnitTypeEnum.Mm);
report.Report.C1Document.PageLayout.PageSettings.PaperKind = System.Drawing.Printing.PaperKind.A4;
report.Report.Fields["lblLoggedUser"].Text = loggedUser.Name;
report.Report.Fields["lblParamFechaHora"].Text = string.Format("{0:dd/MM/yyyy HH:mm:ss }", DateTime.Now);
report.Report.DataSource.Recordset = users;
var countActivos = users.AsEnumerable().Count(r=> r.Field<int>("STATUS_ID") == 1);
var countInactivos = users.AsEnumerable().Count(r => r.Field<int>("STATUS_ID") == 0);
report.Report.Fields["lblUserActivo"].Text = countActivos.ToString();
report.Report.Fields["lblUserInactivos"].Text = countInactivos.ToString();
#region Export report
report.Visible = true;
report.Width = 1;
report.Height = 1;
DirectoryInfo di = new DirectoryInfo(string.Format("{0}/{1}",
HttpContext.Current.Request.PhysicalApplicationPath,
GenericService.Instance.GetConfigurationParameter(ConfigurationParamType.ReportsTemp)));
if (!di.Exists)
{
di.Create();
}
report.ExportFolder = GenericService.Instance.GetConfigurationParameter(ConfigurationParamType.ReportsTemp);
if (!exportXls)
report.Export(ExportFormatsEnum.PDF);
else
report.Export(ExportFormatsEnum.XLS);
#endregion
}
catch (Exception ex)
{
Logger.Error(ex.Message);
}
}
