![]() |
Telelogic DOORS (steve huntington) | ![]() |
new topic :
profile :
search :
help :
dashboard :
calendar :
home
|
||
Latest News:
|
|
Topic Title: OLE Sizing When Exported to Word Topic Summary: Created On: 5-Jan-2004 22:39 Status: Post and Reply |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|
We have embedded Visio and PowerPoint OLE objects in modules. We have automation in place, scheduled tasks, that daily publish Word and HTML documents from DOORS modules to a server directory for web access. The problem... Most of the Visio and PowerPoint OLE objects are larger than the standard 8.5X11 page (Word - With HTML, this isn't a problem).
I've been fighting with the Word script to determine the size of an OLE object and reformat, if necessary, to no larger than 6.5" wide when exported. Has anyone had to do this? Looking for assistance with OLE automation to handle this. Thanks! -=[ Bob Padilla ]=- |
|
![]() |
|
![]() |
|
Bob,
We have similar problems. See my earlier posting. The OLE-object does not size automatically when exported to DOORS (we work in DOORS 5.2). Is there anyone out there that has found a solution to this problem? BTW, we checked: the same problem persists in DOORS 7 SR1, although the OLE object behaves differently when edited from DOORS. Pieter de Waard NHIndustries ------------------------- Pieter de Waard www.nhindustries.com |
|
![]() |
|
![]() |
|
Hi Bob, hi Pieter,
we had the same problem (as anybody will have, I think ...). The solution I choose to fight it was to write a Word Macro which loops through all OLE objects in a word document and resizes them (in correct scale) so that they fit on a A4 page. This macro is called by the DXL word export script after the module content is exported completely, so after export all exported OLE objects are resized automatically. This is the macro: Sub resizeAllShapes() ' ' resizeAllShapes Makro ' Makro aufgezeichnet am 11.06.03 von Anton S. Drexler ' For Each embeddedForm In ActiveDocument.InlineShapes Wd = embeddedForm.Width Ht = embeddedForm.Height Rt = Ht / Wd Ht = 524.4 * Rt If embeddedForm.Width > 525 Then embeddedForm.LockAspectRatio = msoTrue embeddedForm.Width = 524.4 embeddedForm.Height = Ht End If Rt = Ht / Wd Wd = 651.95 / Rt If embeddedForm.Height > 652 Then embeddedForm.LockAspectRatio = msoTrue embeddedForm.Width = Wd embeddedForm.Height = 651.95 End If Next embeddedForm End Sub Explanation to the numbers: 524.4 is the maximal usable width of the page in points (= 18.5 cm) 651,95 is the maximal usable height of the page in points (= 23.0 cm) where 1 cm = 28,35 points The usable width is determined by the paragraph style you are using, i.e. calculated as the the difference between left and right margins. The usable height is determined by the top and bottom margins you use in your word document. The macro is used in DXL by the DXL function: void correctFigureSize () { clear objArgBlock put (objArgBlock, "MacroName", "resizeAllShapes") checkRes (oleMethod (objWord, "Run", objArgBlock)) } which is called after completion of the export. Try it and give me feedback! Toni Drexler Consultant for Quality Management and Requirement Management a.s.drexler@gmx.de (at the moment at Eurocopter Germany) |
|
![]() |
|
![]() |
|
Toni,
Thanks for sharing this macro. Will give it a go (when we find the time ...). Pieter ------------------------- Pieter de Waard www.nhindustries.com |
|
![]() |
|
![]() |
|
Toni,
I like the idea and it worked OK but its difficult to make sure users have a copy of the macro as well as the export script. An alternative method is to code the whole thing in DXL which can then be part of the export script. The following routine can be called at the end of the export. void wordResizeAllShapes() { // Resize shapes if they don't fit on an A4 Portrait page OleAutoObj objInlineShapes = null OleAutoObj objShape = null int nShapes vbaCheckRes(oleGet(objDoc, "InlineShapes", objInlineShapes)) vbaCheckRes(oleGet(objInlineShapes, "Count", nShapes)) int i for (i = 1; i <= nShapes; i++) { clear objArgBlock put(objArgBlock,i) vbaCheckRes(oleMethod(objInlineShapes, "Item", objArgBlock, objShape)) int wd0 int ht0 real rt vbaCheckRes(oleGet(objShape, "Width", wd0)) vbaCheckRes(oleGet(objShape, "Height", ht0)) rt = realOf(ht0) / realOf(wd0) int ht = intOf(445.1 * rt) int wd if (wd0 >= 446) { vbaCheckRes(olePut(objShape, "LockAspectRatio", -1)) wd = 445 vbaCheckRes(olePut(objShape, "Width", wd)) vbaCheckRes(olePut(objShape, "Height", ht)) } else { wd = wd0 ht = ht0 } rt = realOf(ht) / realOf(wd) wd = intOf(595.35 / rt) if (ht >= 596) { vbaCheckRes(olePut(objShape, "LockAspectRatio", -1)) ht = 595 vbaCheckRes(olePut(objShape, "Width", wd)) vbaCheckRes(olePut(objShape, "Height", ht)) } } closeIfNonNull objShape closeIfNonNull objInlineShapes } Jon NB I changed your numbers a bit to fit my page ------------------------- Jonathan Marshall EADS Astrium |
|
![]() |
|
![]() |
|
Anyone want another solution? I export to RTF rather than Word, mainly because that means I can do some extra things like adding headers, footers, default opening pages and styles from a second specially formatted formal module. I check the size of the OLE objects in RTF form while they're still in DOORS, so all my processing is done in DXL. That way I don't have to run Word macros at all, so the export is significantly quicker than writing to Word using automation.
The bit that does the resizing is given below. Note that this is a section of a bigger DXL script file, so some of it might note make sense -- I think I've got most of it in there though... PS If this is bad code, could somebody let me know before I go creating bucket-loads more of the stuff? Ta ![]() ------------------------- Paul dot Tiplady at TRW dot com TRW Automotive Edited: 23-Apr-2004 at 10:35 by Paul Tiplady |
|
![]() |
Telelogic DOORS
» DXL Exchange
»
OLE Sizing When Exported to Word
|
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.