添加c:strRef和c:numRef节点 [英] Adding c:strRef and c:numRef nodes

查看:138
本文介绍了添加c:strRef和c:numRef节点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Excel中动态创建图表。生成的excel文件错过了(c:strRef和c:numRef节点),导致图表无法导入某些Powerpoint幻灯片。

Am dynamically creating a chart in Excel. Generated excel file misses the (c:strRef and c:numRef nodes), making chart unable to get imported to some Powerpoint slide.

 

通过任何特定图表的代码生成上述缺失节点所需的帮助。在此先感谢。

Help needed to generate the above missing nodes through code for any specific chart. Thanks, in advance.

 

谢谢,

Imtiaz Qamar

Imtiaz Qamar

 

推荐答案

Hi Imtiaz,

Hi Imtiaz,

这不应该是困难的。一般来说,您需要这样做:

That should not be diffcult. In general, you need to do:

1。访问图表部分

2.获取StringReference和NumberReference

3.删除这些的所有子节点

4.遍历所有子节点图表范围的值并将其附加到此处

1. Access the Chart part
2. Get hold of StringReference and NumberReference
3. Delete all the child nodes of these
4. Loop through all the values of the Chart Range and append it here

这是一段代码,我为Poweroint写了几个monts来更新StringReference和NumberReference。请参阅以实现此目的:

Here is a piece of code I wrote few monts back for Poweroint to update StringReference and NumberReference. Refer this for achieving this:

========

    Public Sub ModifyChart(ByRef chartpart As ChartPart,ByVal Text As String,ByVal Value As Double)

========
    Public Sub ModifyChart(ByRef chartpart As ChartPart, ByVal Text As String, ByVal Value As Double)



         Dim chartSpace As C.ChartSpace = chartpart.ChartSpace

        Dim barChart As C.BarChart = chartSpace.Descendants(Of C.BarChart).FirstOrDefault

        Dim barChartSeries As C.BarChartSeries = barChart.Descendants(Of C.BarChartSeries).FirstOrDefault()

        Dim categoryAxisData As C.CategoryAxisData = barChartSeries.Descendants(Of C.CategoryAxisData).FirstOrDefault()

       昏暗值为C.Values = barChartSeries.Descendants(Of C.Values).FirstOrDefault()

        Dim stringReference As C.StringReference = categoryAxisData.Descendants(Of C.StringReference).FirstOrDefault()

        Dim strFormula1,strFormula2 As String


        Dim chartSpace As C.ChartSpace = chartpart.ChartSpace
        Dim barChart As C.BarChart = chartSpace.Descendants(Of C.BarChart).FirstOrDefault
        Dim barChartSeries As C.BarChartSeries = barChart.Descendants(Of C.BarChartSeries).FirstOrDefault()
        Dim categoryAxisData As C.CategoryAxisData = barChartSeries.Descendants(Of C.CategoryAxisData).FirstOrDefault()
        Dim values As C.Values = barChartSeries.Descendants(Of C.Values).FirstOrDefault()
        Dim stringReference As C.StringReference = categoryAxisData.Descendants(Of C.StringReference).FirstOrDefault()
        Dim strFormula1, strFormula2 As String

        Dim uintVal As UInt32Value = New UInt32Value

        strFormula1 =" Sheet1!

        Dim uintVal As UInt32Value = New UInt32Value
        strFormula1 = "Sheet1!


A


2:


这篇关于添加c:strRef和c:numRef节点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆