Chart.SideWall 属性

获取一个对象,该对象表示三维图表的侧面墙。

命名空间:  Microsoft.Office.Tools.Excel
程序集:  Microsoft.Office.Tools.Excel(在 Microsoft.Office.Tools.Excel.dll 中)

语法

声明
ReadOnly Property SideWall As Walls
    Get
Walls SideWall { get; }

属性值

类型:Microsoft.Office.Interop.Excel.Walls
一个 Microsoft.Office.Interop.Excel.Walls 对象,表示三维图表的侧面墙。

备注

使用 SideWall 属性可以设置三维图表的侧面墙的格式。

示例

下面的代码示例向 Sheet1 中添加三维簇状柱形图,并将其样式设置为样式 4。 然后,该示例创建一组任意数据,并将其设置为图表源数据。 接下来,该代码指定图表墙纸和图表基底的颜色。

Private Sub SetChartBackWalls()
    ' Add a new chart and populate source data
    Dim myNewChart As Microsoft.Office.Tools.Excel.Chart = _
    Globals.Sheet1.Controls.AddChart( _
        Globals.Sheet1.Range("D5", "J16"), "myNewChart")
    myNewChart.ChartType = Excel.XlChartType.xl3DColumnClustered
    ' Set chart style
    myNewChart.ChartStyle = 4

    Globals.Sheet1.Range("A1").Value2 = "Product"
    Globals.Sheet1.Range("B1").Value2 = "Units Sold"
    Dim i As Integer
    For i = 1 To 3
        Globals.Sheet1.Range("A" + (i + 1).ToString()).Value2 = _
            "Product" + i.ToString()
        Globals.Sheet1.Range("B" + (i + 1).ToString()).Value2 = i * 10
    Next
    Dim data As Excel.Range = Globals.Sheet1.Range("A1", "B4")
    myNewChart.SetSourceData(data)

    ' Set foreground color for 3D chart walls and floor
    myNewChart.BackWall.Format.Fill.ForeColor.RGB = _
        System.Drawing.Color.LightGray.ToArgb()
    myNewChart.SideWall.Format.Fill.ForeColor.RGB = _
        System.Drawing.Color.LightGray.ToArgb()
    myNewChart.Floor.Format.Fill.ForeColor.RGB = _
        System.Drawing.Color.Gray.ToArgb()
End Sub
private void SetChartBackWalls()
{
    // Add a new chart and populate source data
    Microsoft.Office.Tools.Excel.Chart myNewChart =
    Globals.Sheet1.Controls.AddChart(
        Globals.Sheet1.Range["D5", "J16"], "myNewChart");
    myNewChart.ChartType = Excel.XlChartType.xl3DColumnClustered;
    // Set chart style
    myNewChart.ChartStyle = 4;

    Globals.Sheet1.Range["A1",missing].Value2 = "Product";
    Globals.Sheet1.Range["B1",missing].Value2 = "Units Sold";

    for (int i=1; i<4; i++)
    {
        Globals.Sheet1.Range["A" + (i + 1).ToString(),missing].Value2 =
            "Product" + i.ToString();
        Globals.Sheet1.Range["B" + (i + 1).ToString(),missing].Value2 = 
            i * 10;
    }
    Excel.Range data = Globals.Sheet1.Range["A1", "B4"];
    myNewChart.SetSourceData(data,missing);

    // Set foreground color for 3D chart walls and floor
    myNewChart.BackWall.Format.Fill.ForeColor.RGB =
        System.Drawing.Color.LightGray.ToArgb();
    myNewChart.SideWall.Format.Fill.ForeColor.RGB =
        System.Drawing.Color.LightGray.ToArgb();
    myNewChart.Floor.Format.Fill.ForeColor.RGB = 
        System.Drawing.Color.Gray.ToArgb();        
}

.NET Framework 安全性

请参见

参考

Chart 接口

Microsoft.Office.Tools.Excel 命名空间