Adding a sheet to a drawing |
Top Previous Next |
Here is a graphical overview of Drawings Sheets and Views:
Note that when you first create a drawing you already have a single sheet, so often there is no need to add another one.
Anyway, to add a Sheet to a drawing you must get hold of the drawing object's Sheets list and call the Add method. Here is a fragment, error checking removed:
CComQIPtr<DrawingDocument> pDrawingDoc ; pDrawingDoc = ...
CComPtr<Sheets> pSheets = nullptr ; pDrawingDoc->get_Sheets(&pSheets) ;
CComVariant varReal (0.0) ; CComPtr<Sheet> pSheet = nullptr ; pSheets->Add (kA3DrawingSheetSize, kDefaultPageOrientation, L"View77", varReal, // width (not used in this case) varReal, // height (not used in this case) &pSheet) ;
The DrawingSheetSizeEnum Enumerator (first parameter in the above call to Add) has many options, here a just a few:
kA3DrawingSheetSize 9996 A3 size (typically for metric units). kA4DrawingSheetSize 9997 A4 size (typically for metric units). kADrawingSheetSize 9987 A size (typically for inch units). kBDrawingSheetSize 9988 B size (typically for inch units). kCDrawingSheetSize 9989 C size (typically for inch units). kCustomDrawingSheetSize 9986 Custom size. Does (may) not fit one of the standard sizes.
If you use kCustomDrawingSheetSize then Width and Height must be specified.
The orientation of the sheet (second parameter in the above call to Add) will be one of these:
kDefaultPageOrientation 10241 Specifies the default setting. kLandscapePageOrientation 10242 Page is oriented as a Landscape. kPortraitPageOrientation 10243 Page is oriented as a Portrait.
You'll see the two drawings in a single sheet in the browser like this:
See also Landscape and Portrait orientation.
|
Text, images and diagrams © 2021 Owen F. Ransen. All rights reserved. (But copy the source code as much as you want!)