Hi,
Thanks for all your help in the last days. I have a doubt gettin a text in the Fcc Container an Pool / line. I Used the code of the example guide, but I cant find in this shapes.
This is the code and attached is the project (vs 2015).
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Aspose.Diagram;
using System.Data;
using Aspose.Diagram;
using System.IO;
using System.Text.RegularExpressions;
namespace GetText
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btnRead_Click(object sender, EventArgs e)
{
readfile("file.vsd");
}
private void readfile(string fileName)
{
DataTable dt = new DataTable();
dt.Columns.Add(new System.Data.DataColumn("Shape", typeof(string)));
dt.Columns.Add(new System.Data.DataColumn("Shape Id", typeof(string)));
dt.Columns.Add(new System.Data.DataColumn("Text", typeof(string)));
dt.Columns.Add(new System.Data.DataColumn("Master", typeof(string)));
string licencepath = @"d:\Aspose.Total.lic";
Aspose.Diagram.License diagramLicense = new Aspose.Diagram.License();
diagramLicense.SetLicense(licencepath);
FileStream st = new FileStream(fileName, FileMode.Open);
Diagram vsdDiagram = new Diagram(st);
foreach (Aspose.Diagram.Page page in vsdDiagram.Pages)
{
foreach (Aspose.Diagram.Shape shape in page.Shapes)
{
DataRow r = dt.NewRow();
r["Shape"] = shape.Name + "-" + shape.NameU;
r["Shape Id"] = shape.ID.ToString();
r["Text"] = GetShapeText(shape);
r["Master"] = shape.Master.Name;
dt.Rows.Add(r);
}
}
dataGridView1.DataSource = dt;
}
private string GetShapeText(Aspose.Diagram.Shape shape)
{
string shapeText = "";
if (shape.Text.Value.Text != "")
shapeText += Regex.Replace(shape.Text.Value.Text, "\\<.*?>", "");
if (shape.Type == TypeValue.Foreign)
shapeText += (shape.Name);
if (shape.Type == TypeValue.Group)
foreach (Aspose.Diagram.Shape subshape in shape.Shapes)
{
GetShapeText(subshape);
}
return shapeText;
}
}
}
Thank you for your patience and great help!!
Consu