【问题标题】:Visio how to add data graphics on Visio shapes using C# code?Visio如何使用C#代码在Visio形状上添加数据图形?
【发布时间】:2022-11-12 03:52:47
【问题描述】:

我正在使用 Visio Professional 2021 和 VS 2019 进行开发。

我想按照下面的屏幕截图将数据图形添加到我在 Visio 中添加的形状中。你能在 C# 中提出一些可能性吗?

下面是我尝试过的代码

short customProps = (short)VisSectionIndices.visSectionProp;

short rowNumber = shape.AddRow(customProps, (short)VisRowIndices.visRowLast, (short)VisRowTags.visTagDefault);

shape.CellsSRC[customProps, rowNumber, (short)VisCellIndices.visCustPropsLabel].FormulaU = "\"" + PropertyName + "\"";

shape.CellsSRC[customProps, rowNumber, (short)VisCellIndices.visCustPropsValue].FormulaU = "\"" + propertyValue + "\"";

但我想按照显示的图像在每个形状上添加数据图形。

【问题讨论】:

  • 希望this article 和 VBA 代码可以帮助
  • 我已经浏览了这些文件,但我的疑问是如何使用 c#/vba 代码创建数据图形项?
  • 你读过文章Assembling data graphics programmatically了吗?你也可以下载SDK,在那里你可以找到模块cs_CustomiseDataGraphics

标签: c# visio


【解决方案1】:

在 Visio 用户界面中,它们被称为:数据图形

在对象模型代码中,它们被称为:GraphicItems

https://learn.microsoft.com/en-us/office/vba/api/visio.graphicitems

在文章中你会发现:

*笔记 您必须使用 Visio 用户界面创建类型为 visTypeDataGraphic 的母版 - 您不能以编程方式创建它们。

AddCopy 方法将现有 GraphicItem 对象的副本添加到 GraphicItems 集合。要添加的 GraphicItem 对象必须已经存在于另一个类型为 visTypeDataGraphic 的主控中。

https://learn.microsoft.com/en-us/office/vba/api/visio.graphicitems.addcopy

【讨论】:

    猜你喜欢
    • 2022-11-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-15
    • 1970-01-01
    • 2012-07-04
    • 1970-01-01
    相关资源
    最近更新 更多