.net Excel互操作图表隐藏图表区文本
我使用下面的代码(VB.Net和Microsoft Excel Interop)创建了以下图表对象 我试图隐藏以椭圆形标记的文本,但我无法隐藏。请告诉我隐藏该文本的设置。我已尝试将Axix文本设置为空,但无法工作。.net Excel互操作图表隐藏图表区文本,.net,vb.net,excel,interop,excel-interop,.net,Vb.net,Excel,Interop,Excel Interop,我使用下面的代码(VB.Net和Microsoft Excel Interop)创建了以下图表对象 我试图隐藏以椭圆形标记的文本,但我无法隐藏。请告诉我隐藏该文本的设置。我已尝试将Axix文本设置为空,但无法工作。 我不确定它是否有用,但在进行任何自动化之前,我总是先从现有的Excel文件开始,在Excel中手动设置所有图表和格式。然后用.Net填充数据。只要我的2美分。谢谢。我也在做同样的事情。我发现我必须删除轴。但不确定是否有帮助。可以通过添加以下行来实现这一点。.Axes(Excel.Xl
我不确定它是否有用,但在进行任何自动化之前,我总是先从现有的Excel文件开始,在Excel中手动设置所有图表和格式。然后用.Net填充数据。只要我的2美分。谢谢。我也在做同样的事情。我发现我必须删除轴。但不确定是否有帮助。可以通过添加以下行来实现这一点。.Axes(Excel.XlAxisType.xlCategory,Excel.XlAxisGroup.xlPrimary)。Delete()不确定是否有帮助,但在执行任何自动化操作之前,我总是从一个现有的Excel文件开始,在Excel中手动设置所有图表和格式。然后用.Net填充数据。只要我的2美分。谢谢。我也在做同样的事情。我发现我必须删除轴。但不确定是否为hot to。可以通过添加以下行来实现这一点。.Axes(Excel.XlAxisType.xlCategory,Excel.XlAxisGroup.xlPrimary)。Delete()
Dim ColumnChart As Microsoft.Office.Interop.Excel.Chart
Dim ColumnChartShape As Microsoft.Office.Interop.Excel.Shape = oSheet.Shapes.AddChart()
ColumnChart = ColumnChartShape.Chart
CCLastRow = oSheet.Rows.End(Excel.XlDirection.xlDown)
CCLR = oSheet.UsedRange.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeLastCell).Row
CCLC = oSheet.UsedRange.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeLastCell).Column
oSheet.Range("$C$3:" & GetExcelColumn(CCLC) & CCLastRow.Row).NumberFormat = "$#,##0_);($#,##0)"
ColumnChartSourceRange = oSheet.Range("$B$3:" & GetExcelColumn(CCLC) & CCLastRow.Row)
With ColumnChart
.ChartWizard(Source:=ColumnChartSourceRange, Title:="Purchases - " + TextPeriod1Name + " vs " + TextPeriod2Name, PlotBy:=Microsoft.Office.Interop.Excel.XlRowCol.xlColumns)
.ApplyLayout(9, Microsoft.Office.Interop.Excel.XlChartType.xlColumnClustered)
.ChartStyle = 34
.ApplyDataLabels(Microsoft.Office.Interop.Excel.XlDataLabelsType.xlDataLabelsShowLabel, False, False, False, False, False, True)
.SeriesCollection(1).DataLabels.Position = Microsoft.Office.Interop.Excel.XlDataLabelPosition.xlLabelPositionOutsideEnd
.SeriesCollection(1).Interior.Color = RGB(132, 175, 104)
.SeriesCollection(2).DataLabels.Position = Microsoft.Office.Interop.Excel.XlDataLabelPosition.xlLabelPositionOutsideEnd
.SeriesCollection(2).Interior.Color = RGB(19, 46, 66)
.PlotArea.Border.Weight = 1
.PlotArea.Border.Weight = 1
.PlotArea.Border.Color = ColorTranslator.ToOle(Color.Gray)
.ChartArea.Width = 563.04
.ChartArea.Height = 311.76
.ChartArea.Border.Weight = 1
.ChartArea.Border.LineStyle = 0
.Axes(Excel.XlAxisType.xlCategory, Excel.XlAxisGroup.xlPrimary).HasTitle = True
.Axes(Excel.XlAxisType.xlCategory, Excel.XlAxisGroup.xlPrimary).AxisTitle.Characters.Text = ""
.Axes(Excel.XlAxisType.xlValue, Excel.XlAxisGroup.xlPrimary).HasTitle = True
.Axes(Excel.XlAxisType.xlValue, Excel.XlAxisGroup.xlPrimary).AxisTitle.Characters.Text = ""
.Axes(Excel.XlAxisType.xlValue, Excel.XlAxisGroup.xlPrimary).TickLabels.NumberFormat = "$#,##0"
.Axes(Excel.XlAxisType.xlValue).MinimumScaleIsAuto = False
.Axes(Excel.XlAxisType.xlValue).MinimumScale = 0
.ChartArea.Format.TextFrame2.TextRange.Font.Size = 12
.Legend.Format.TextFrame2.TextRange.Font.Size = 12
.ChartArea.Format.TextFrame2.TextRange.Font.Bold = Microsoft.Office.Core.MsoTriState.msoTrue
.Legend.Format.TextFrame2.TextRange.Font.Bold = Microsoft.Office.Core.MsoTriState.msoTrue