![]() |
#1
|
|||
|
|||
![]()
Hi, I want get all the information of objects in one page. for example, count .type .position ,size , fontName,and so on. I see some functions like this: GetObjectCount.GetObjectData.GetObjectType et al. How to use these? I can't find any help and code in draw_vba.chm.
How can i do that? Thanks, nathan |
#2
|
|||
|
|||
![]()
Hi Nathan,
I have a complete started project and some notes of using C++ with CorelDRAW at my forum: http://www.leonardcncsoftware.com/ph....php?f=13&t=12 These projects (a plugin and a DLL) show how to make a hybrid application that runs from a CorelDRAW plugin but has most of the code in a DLL. There is a debug message system which is essential for working woth plugins and DLLS. To get all the objects (shapes) on a page you must access the individual layers. I typically write functions to use the ActiveLayer so I can simply activate a layer then use the function, it is universal. Here is a sample that shows how to iterate the shapes on the ActiveLayer: Code:
IDrawApplicationPtr app(CDR_PROGID); if (NULL != app) { DbgMsg(("app ptr OK")); IDrawDocumentPtr doc = app->ActiveDocument; if (NULL != doc) { IDrawLayerPtr layer = doc->ActiveLayer; if (NULL != layer) { DbgMsg(("layer ptr ok")); layer->get_Shapes(&shapes); if (NULL != shapes) { DbgMsg(("shapes")); // shapes->Count is the number of shapes on this layer for (shpIdx = 1L; shpIdx <= shapes->Count; shpIdx++) { shape = shapes->Item[_variant_t(shpIdx)]; // shape->Type is the shape type - I.E. cdrCurveShape // this is in the cdrShapeType enum in the .tlh file // that was generated from the #import // shape->PositionX = X location // shape->PositionY = Y location // shape->SizeHeight = height // shape->SizeWidth = width } } } } } |
#3
|
|||
|
|||
![]()
thank you very much!
![]() |
#4
|
|||
|
|||
![]()
code:
shape->Type ; or shape->GetType(); error: error C2556: 'enum cdrShapeType __thiscall CorelDRAW::IDrawShape::GetType(void)' : overloaded function differs only by return type from 'enum CorelDRAW::cdrShapeType __thiscall CorelDRAW::IDrawShape::GetType( void)' I would like to determine the type. How Can I do? |
#5
|
|||
|
|||
![]()
Hi Nathan,
I was at my day job, working from memory. Sorry... First declare the type variable; CorelDRAW::cdrShapeType st; Then you can retrieve it with: hr = shape->get_Type(&st); hr is a HRESULT that you can test for SUCCEEDED -James |
#6
|
|||
|
|||
![]()
Hi James.
Thank you for your help!Your answer is very clear,and I can get all object . these are the other three questions ![]() question one: I open a file of cdr, but the system does not contain the relevant fonts, for example, cdr file used the font of "Wingdings 2", but my system does not install. In corelDRAW, Tips out of the dialog box.Let us choose a existing font to replace missing fonts. but in the VC,How can I know whether same fonts have miss and what the missing fonts are? question two: I read a cdrTextShape in a file, the shape like this " nathan luxu summy clover mary jason " these six names are in a shape. I can get the positon of the shape. How do I get the position of each name? for example , I want know the position of mary. question three: if the shape is a image , I want to export it; what can I do? |
#7
|
|||
|
|||
![]()
I know that use this code to pop up a PANOSE matching dialog.
code: CorelDRAW::IDrawApplicationPtr app(__uuidof(CorelDRAW::Application)); app->Visible = VARIANT_TRUE; app->InitializeVBA(); app->put_PanoseMatching(CorelDRAW::cdrPanosePrompt); CorelDRAW::IDrawDocumentPtr doc = app->OpenDocument(_bstr_t(Path),0); It works well! But I want to know which text shape is missing fonts and the names of the missed fonts ? How can I do? |
#8
|
|||
|
|||
![]()
Hi Nathan,
I do not know if this can be done. You should ask the VBA experts first and search the forums for solutions in VBA. Then you can work out how to do it in C++. I have never had a need for this so I have no idea or any code to show. -James |
#9
|
|||
|
|||
![]()
Hi All,
Along these lines, has anyone tried to scan through an open document and serialize to an XML document the various objects? It would be nice to export customized document objects to XML string to store in Database for recreation later (maybe even deserialize back)... Thanks much, Craig. |
#10
|
|||
|
|||
![]()
Hi Craig,
I currently do a version of that with a customized DXF export for CAD / CAM use. You can see that at: http://www.coreldrawtools.com BUT, completely capturing the state of a CorelDRAW document would be a daunting task. I'm not sure the object model has all the features needed to do that. -James |
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Positionin few object to few object | VaaL2004 | CorelDRAW/Corel DESIGNER VBA | 1 | 10-10-2008 01:18 |
Duplicating original page for multi-page layout | psypha | General | 1 | 06-08-2007 14:05 |
Selected object to other page Duplicate method ? | ljesus7 | CorelDRAW/Corel DESIGNER VBA | 5 | 12-02-2007 16:37 |
How to select object inside another object | jukos | General | 4 | 24-10-2005 21:27 |
Page selection and object moving problems | wbochar | CorelDRAW/Corel DESIGNER VBA | 1 | 15-04-2003 09:10 |