
Lakshmi Thangaraj
Top achievements
Rank 1
Lakshmi Thangaraj
asked on 09 Feb 2011, 12:30 PM
Hai
I am exporting a grid with minimum 5 Columns. Two of these columns are having number data an they are aligned to right. When i am exporting the grid to excel the numbers are aligned to right. But in case of word and pdf the values are aligned at the left. How can i align this number values to right in PDF and Word?
Thanks
I am exporting a grid with minimum 5 Columns. Two of these columns are having number data an they are aligned to right. When i am exporting the grid to excel the numbers are aligned to right. But in case of word and pdf the values are aligned at the left. How can i align this number values to right in PDF and Word?
Thanks
4 Answers, 1 is accepted
0

Shinu
Top achievements
Rank 2
answered on 09 Feb 2011, 01:17 PM
Hello Lakshmi,
Try the following code snippet in ItemCommand and check whether it woks now.
C#:
-Shinu.
Try the following code snippet in ItemCommand and check whether it woks now.
C#:
protected
void
RadGrid1_ItemCommand(
object
sender, GridCommandEventArgs e)
{
if
(e.CommandName == RadGrid.ExportToPdfCommandName)
{
GridItem headerItem = RadGrid1.MasterTableView.GetItems(GridItemType.Header)[0];
foreach
(TableCell cell
in
headerItem.Cells)
{
cell.Style[
"text-align"
] =
"right"
;
}
foreach
(GridDataItem item
in
RadGrid1.Items)
{
foreach
(TableCell cell
in
item.Cells)
{
cell.Style[
"text-align"
] =
"right"
;
}
}
}
}
-Shinu.
0

Lakshmi Thangaraj
Top achievements
Rank 1
answered on 10 Feb 2011, 08:19 AM
Thanks For your Reply. But it does not work. The events is not get fired when i click the export button. But it works in item created event. I don;t want all the columns aligned at the right. How can i make a particular column aligned to right?
Thanks
Thanks
0

Shinu
Top achievements
Rank 2
answered on 10 Feb 2011, 09:20 AM
Hello Lakshmi,
If you want to apply style for only one cell, you can access the cell using its UniqueName like below.
C#:
-Shinu.
If you want to apply style for only one cell, you can access the cell using its UniqueName like below.
C#:
GridDataItem item=(GridDataItem)e.Item;
TableCell cell =(TableCell)item[
"ColumnUniqueName"
];
cell.Style[
"text-align"
] =
"right"
;
-Shinu.
0

Lakshmi Thangaraj
Top achievements
Rank 1
answered on 11 Feb 2011, 06:01 AM
Thanks Shinu
It works. Thanks For your reply. I have another issue in exporting to pdf. I exported the grid to PDF. When i open the PDF document it shown in 22% view format. Show i set width and height to PDf .
grid.ExportSettings.Pdf.PageHeight = Unit.Parse("297mm");
grid.ExportSettings.Pdf.PageWidth = Unit.Parse("270mm");
But now it open in 82% view. How can i make it to open in normal view that is 100% view.
Thanks
It works. Thanks For your reply. I have another issue in exporting to pdf. I exported the grid to PDF. When i open the PDF document it shown in 22% view format. Show i set width and height to PDf .
grid.ExportSettings.Pdf.PageHeight = Unit.Parse("297mm");
grid.ExportSettings.Pdf.PageWidth = Unit.Parse("270mm");
But now it open in 82% view. How can i make it to open in normal view that is 100% view.
Thanks