xtrareports-devexpress-dot-xtrareports-dot-ui-dot-xtrareport-dot-savelayouttoxml-x28-system-dot-string-x29.md
Using file paths sourced from untrusted input may expose unauthorized files or allow unintended file access. Always validate and normalize all external paths to prevent path manipulation.
Saves the report in XML format to the specified file.
Namespace : DevExpress.XtraReports.UI
Assembly : DevExpress.XtraReports.v25.2.dll
NuGet Package : DevExpress.Reporting.Core
public void SaveLayoutToXml(
string fileName
)
Public Sub SaveLayoutToXml(
fileName As String
)
| Name | Type | Description |
|---|---|---|
| fileName | String |
A String that is the name of the file to which to save the report.
|
Use the SaveLayoutToXml and XtraReport.LoadLayoutFromXml methods to store reports in XML format.
Review the following topics for more information:
The following code snippets (auto-collected from DevExpress Examples) contain references to the SaveLayoutToXml(String) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
reporting-web-customize-web-report-wizard/CS/MvcWizardCustomization/ReportStorageWebExtension.cs#L58
// This method is called only after the IsValidUrl and CanSetData methods are called.
report.SaveLayoutToXml(Path.Combine(reportDirectory, url + FileExtension));
}
throw new NotSupportedException("Saving is not allowed."); //Comment this line to enable saving
report.SaveLayoutToXml(filePath);
}
// This method is called only after the IsValidUrl and CanSetData methods are called.
report.SaveLayoutToXml(Path.Combine(reportDirectory, url + FileExtension));
}
{
report.SaveLayoutToXml(Path.Combine(reportDirectory, url + FileExtension));
}
reporting-asp-net-core-drill-through/CS/Startup.cs#L50
foreach(var report in PredefinedReports.ReportsFactory.Reports) {
report.Value().SaveLayoutToXml(Path.Combine(env.ContentRootPath, CustomReportProviderAsync.MyReportsDirectoryName, report.Key + ".repx"));
}
Throw New NotSupportedException("Saving is not allowed.") 'Comment this line to enable saving
report.SaveLayoutToXml(filePath)
Catch ex As Exception
' This method is called only after the IsValidUrl and CanSetData methods are called.
report.SaveLayoutToXml(Path.Combine(reportDirectory, url & FileExtension))
End Sub
Public Overrides Sub SetData(ByVal report As DevExpress.XtraReports.UI.XtraReport, ByVal url As String)
report.SaveLayoutToXml(Path.Combine(reportDirectory, url & FileExtension))
End Sub
If Not IsWithinReportsFolder(url, reportDirectory) Then Throw New FaultException(New FaultReason("Invalid report name."), New FaultCode("Server"), "GetData")
report.SaveLayoutToXml(Path.Combine(reportDirectory, url & FileExtension))
End Sub
If Not IsWithinReportsFolder(url, reportDirectory) Then Throw New FaultException(New FaultReason("Invalid report name."), New FaultCode("Server"), "GetData")
report.SaveLayoutToXml(Path.Combine(reportDirectory, url & FileExtension))
End Sub
See Also