0

Telerik radGridView1を持っていて、Excelにエクスポートしていますが、Excelファイルに境界線が表示されていません。それで、それをボーダーでエクスポートする方法。私はこの方法でエクスポートしています...

ExportToExcelML export = new ExportToExcelML(this.radGridView1);
export.ExportVisualSettings = true;
export.RunExport(saveFileDialog1.FileName);

前もって感謝します

4

2 に答える 2

0

エクスポートする前に、ボーダーの rad グリッドの次のプロパティを設定する必要があります

this.radGridView1.GridLines = Both;
this.radGridView1.BorderStyle = BorderStyle.Solid;
ExportToExcelML export = new ExportToExcelML(this.radGridView1);
export.ExportVisualSettings = true;
export.RunExport(saveFileDialog1.FileName);
于 2012-10-25T07:54:48.253 に答える
0

ExcelCellFormattingイベントはあなたを助けるかもしれません:

エクスポートされた RadGridView に関連するすべての Excel セルに対して追加の書式設定 (境界線の追加、配置の設定、テキスト フォント、色、セル値の変更など) を行うことができる単一セルの SingleStyleElement へのアクセスを提供します。

void exporter_ExcelCellFormatting(object sender,Telerik.WinControls.UI.Export.ExcelML.ExcelCellFormattingEventArgs e)
{
    if (e.GridRowInfoType == typeof(GridViewTableHeaderRowInfo))
    {
        BorderStyles border = new BorderStyles();
        border.Color = Color.Black;
        border.Weight = 2;
        border.LineStyle = LineStyle.Continuous;
        border.PositionType = PositionType.Bottom;
        e.ExcelStyleElement.Borders.Add(border);
    }
    else if (e.GridRowIndex == 2 && e.GridColumnIndex == 1)
    {
        e.ExcelStyleElement.InteriorStyle.Color = Color.Yellow;
        e.ExcelStyleElement.AlignmentElement.WrapText = true;
    }
}

詳細については、ここをクリックしください。

于 2012-10-25T13:52:43.333 に答える