Hi,
I have a Rad Grid with data columns and one Image column.
for printing the grid, creating the doc by exporting, so, while exporting image column is exporting as path of the Image instead of printing the image.
I am using WPF RAD Grid.
Please provide solution.
Thanks
Raj
I have a Rad Grid with data columns and one Image column.
for printing the grid, creating the doc by exporting, so, while exporting image column is exporting as path of the Image instead of printing the image.
I am using WPF RAD Grid.
Please provide solution.
Thanks
Raj
3 Answers, 1 is accepted
0
Hi Raj,
Thank you for contacting us.
You could not export images, because you could not embed images in the supported formats.
By that reason, you are getting the path of the image.
For PDF export, you could check the following forum post, which illustrates how to export images from RadGridView.
Regards,
Vanya Pavlova
Telerik
Thank you for contacting us.
You could not export images, because you could not embed images in the supported formats.
By that reason, you are getting the path of the image.
For PDF export, you could check the following forum post, which illustrates how to export images from RadGridView.
Regards,
Vanya Pavlova
Telerik
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
0
RajaGopal
Top achievements
Rank 1
answered on 04 Sep 2014, 02:40 PM
Hi Vanya,
We are creating a Rad rich text box and passing the RadDocument as parameter to it.
Document creating by exporting the grid, using the following method.
and printing from Rad Rich Textbox, Able to print all the columns without any issues along with styles.
I have the problem in printing the image to the Rad document passed to Rad Rich Textbox.
Please suggest if there ia a way in this procedure.
We are creating a Rad rich text box and passing the RadDocument as parameter to it.
Document creating by exporting the grid, using the following method.
private RadDocument CreateDocument(RadGridView grid, PrintSettings settings)
{
RadDocument document = null;
using (var stream = new MemoryStream())
{
//BoardImage.IsVisible = false;
grid.ElementExporting += ExportBoardList;
grid.Export(stream, new GridViewExportOptions()
{
Format = ExportFormat.Html,
ShowColumnFooters = grid.ShowColumnFooters,
ShowColumnHeaders = grid.ShowColumnHeaders,
ShowGroupFooters = grid.ShowGroupFooters
});
grid.ElementExporting -= ExportBoardList;
stream.Position = 0;
document = new HtmlFormatProvider().Import(stream);
document.SectionDefaultPageOrientation = PageOrientation.Portrait;
document.SectionDefaultPageSize = new Size(800, 1024);
document.SectionDefaultPageOrientation = PageOrientation.Landscape;
//BoardImage.IsVisible = false;
}
return document;
}
and printing from Rad Rich Textbox, Able to print all the columns without any issues along with styles.
internal void Print()
{
var grid = RadGridViewBoards as RadGridView;
if (grid != null)
{
m_RowNumber = 1;
var rtb = new RadRichTextBox()
{
Width = 1280,
IsReadOnly = true,
LayoutMode = DocumentLayoutMode.Paged,
IsSelectionEnabled = false,
IsSpellCheckingEnabled = false,
Document = CreateDocument(grid, new PrintSettings())
};
var window = new RadWindow()
{
Height = 0,
Width = 0,
Opacity = 0,
Content = rtb
};
rtb.PrintCompleted += (s, e) =>
{
window.Close();
};
window.Show();
rtb.Print(string.Empty, PrintMode.Native);
}
}
I have the problem in printing the image to the Rad document passed to Rad Rich Textbox.
Please suggest if there ia a way in this procedure.
0
Hello Raj,
In the CreateDocument() method you can specifically handle image values and add the raw data for each image like this:
Please try this out and let us know how it goes.
Regards,
Petya
Telerik
In the CreateDocument() method you can specifically handle image values and add the raw data for each image like this:
EventHandler<GridViewElementExportingEventArgs> elementExporting = (s, e) =>
{
if
(e.Value !=
null
&& e.Value.GetType() ==
typeof
(BitmapImage))
{
e.Value =
"<img src=\""
+ (e.Value
as
BitmapImage).UriSource.OriginalString +
"\" />"
;
e.ShouldEncodeValue =
false
;
}
//...
}
Please try this out and let us know how it goes.
Regards,
Petya
Telerik
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.