GridViewExtension.CreatePrintableObject(GridViewSettings, Object) Method
Enables a GridView to be printed using the XtraPrinting Library.
Namespace: DevExpress.Web.Mvc
Assembly: DevExpress.Web.Mvc5.v24.2.dll
NuGet Package: DevExpress.Web.Mvc5
#Declaration
public static IBasePrintable CreatePrintableObject(
GridViewSettings settings,
object dataObject
)
#Parameters
Name | Type | Description |
---|---|---|
settings | Grid |
An object that contains Grid |
data |
Object | The Grid |
#Returns
Type | Description |
---|---|
IBase |
An interface that allows you to print Grid |
#Remarks
public ActionResult Export()
{
var ps = new PrintingSystem();
var link = new PrintableComponentLink(ps);
link.Component = GridViewExtension.CreatePrintableObject(GetSettings(), DataProvider.GetData().ToList());
// ...
return result;
}
Note
Note that the BeforeCreate
method. Instead, use the Grid
methods to export data.
To apply the grid’s client state, the grid should be placed in a form.
@using (Html.BeginForm("ReportGenerator", "Home")) {
@Html.DevExpress().Button(settings => {
settings.Name = "reportGenerator";
settings.Text = "Generate Report";
settings.UseSubmitBehavior = true;
}).GetHtml()
@Html.Partial("GridViewPartialView", Model)
}
public ActionResult ReportGenerator() {
XtraReport_GridView report = new XtraReport_GridView();
report.AssignGridPrintable(
GridViewExtension.CreatePrintableObject(GetGridViewSettings(), NorthwindDataProvider.GetCustomers())
);
return View("ViewReport", report );
}
#Related GitHub Examples
The following code snippet (auto-collected from DevExpress Examples) contains a reference to the CreatePrintableObject(GridViewSettings, Object) 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.