Update : I am able to get the shapes now, only insertion of texts is remaining, and I am not able to figure out the way to insert text. Now I am getting an exception while creating the instance of the shape class :
System.Runtime.InteropServices.COMException: 'Retrieving the COM class factory for component with CLSID {A77D0076-C6D1-4D32-9F72-F3A62CE56578} failed due to the following error: 80040154 Class not registered (0x80040154 (REGDB_E_CLASSNOTREG)).'
I have nearly 200 cdr files with some shapes containing in it also I have a list of names. Shapes can be nested like rectangle inside rectangle.
I want to generate a new copy of that file with a name from the list in each of the group of shapes(text should be in innermost shape).
Then I have to save that file as svg.
here is what i have tried so far but I am not able to get a way what to do after this.
I used the Coreldraw type library and I am able to open the cdr file but I am not able to figure out which property of the document in corelDraw I should look to get the shapes.
previous questions also did not help me.
Type pia_type = Type.GetTypeFromProgID("CorelDRAW.Application");Application app = Activator.CreateInstance(pia_type) as Application;
app.Visible = true;
Document document = app.OpenDocument(@"Path_To_Cdr");
// Update :
ShapeRange shapes = document.ActivePage.Shapes.FindShapes();
foreach(Shape s in shapes)
{
// this is giving exception
// System.Runtime.InteropServices.COMException: 'Retrieving the COM class factory for component
Shape newShape = new Shape()
{
// Text.Contents = "Eureka!!"
};
s.PlaceTextInside(newShape);
}
Try: