macOS
Preface
This article is mostly intended for users of Ekahau Site Survey Pro generating report documentation.
I encourage you to clean-up, manipulate and prepare your floor plans before importing them into Ekahau. This will save you from a headache when it comes to report-writing time. Image manipulation is much easier before we create the Ekahau project.
However...
Main Attraction
We have all been there... right?
The survey is complete, we have looked through and analysed the collected data. It's time to smash out that report document, only, the coverage map visualisations have a ton of white space surrounding them and the floor plan is minuscule in the centre of the page.
It's a PITA, but, by creating a macro within Word we can automate (and dramatically speed up) the image cropping and resize actions.
- Create and run your Ekahau report template
- Word > PreferencesChange measurement unit to points
- Tools > Macro > Visual Basic Editordouble click "This Document"copy and paste the VBA script below
Sub CropAndResize()
' This macro crops and resizes images
' The units are 'points'
Dim oILS As InlineShape
Set oILS = Selection.InlineShapes(1)
With oILS
.PictureFormat.CropLeft = 100
.PictureFormat.CropTop = 100
.PictureFormat.CropRight = 100
.PictureFormat.CropBottom = 100
End With
With oILS
.LockAspectRatio = True
' .Height = 260
' .Width = 450
End With
lbl_Exit:
Exit Sub
End Sub
Copy
- Click "Save" in the top-left
- You will likely get an error message, cancel
- Save the Document / Macro in the special ".docm" format
- Next, create a shortcut for the macroTools > Customise Keyboard
- Assign a keyboard combo of your choosing
- Test the macro on an image
- The crop values are absolute! Running the macro a second time will not affect the image cumulatively.
- Tools > Macro > Visual Basic EditorMake the changesSave in the top leftClose the window
- Run the macro again using your shortcut
- The macro can also be used to resize the imageTo define the width or height using the macro, remove the apostrophe ' from the appropriate line width or height and set the value in points
- If you are unsure what the point value should be, consider the followingcropping an image using the macroresize the image manually within Wordselect the "Picture Format" within the ribbontake note of the width or heightenter the value into the macro and run again
The macro will need to be applied to each image that requires manipulation, depending on your project, you may need to alter the macro for different shape floors within your report output.When designing your report template, you can use the visualisation tag:
<#"visualization": {"resolution-width": "-1"}#>
This tag sets the resolution of the rendered visualization. This time the unit is in pixels. This tag is often used to reduce the resolution and save space in the resulting generated report...
That is NOT what we are doing here, set to negative 1, to force use the original resolution of the map image.
This should allow you to crop and enlarge the image within Word without it becoming grainy.
Windows Users
Create and run your Ekahau report template
- File > Options > Advanced > DisplayChange:Show measurements in units of to: Points
- OK
- (In the Ribbon) View > Macros > View Macros
- Type "CropAndResize" into the Macro Name fieldClick "Create"
- We are now in the MSWord Visual Basic EditorCopy and paste the VBA script below in the editor in between the lines of Sub "CropAndResize" and "EndSub"Commented out lines within VBA scripts begin with ‘'’
' This macro crops and resizes images
' The units are 'points'
Dim oILS As InlineShape
Set oILS = Selection.InlineShapes(1)
With oILS
.PictureFormat.CropLeft = 100
.PictureFormat.CropTop = 100
.PictureFormat.CropRight = 100
.PictureFormat.CropBottom = 100
End With
With oILS
.LockAspectRatio = True
' .Height = 260
' .Width = 450
End With
lbl_Exit:
Exit Sub
- Click "Save" in the top-left
- You may get an error message, click "cancel"
- Save the Document / Macro into the special ".docm" format
- Once the macro is saved and we are returned to looking at the Word documentCreate a shortcut for the macroFile > Options > Customise RibbonAt the bottom of the screen select Keyboard Shortcuts "Customise"Scroll down through the categories (on the left) to Macros
- Make sure the Macro Name is visible and selected in your Macros box (on the right)
- Assign a keyboard combo of your choosing in ‘Press new shortcut key:’Click "Assign"Then you can close the Options windows
- Test the macro on an imageby selecting the image and using the newly created keyboard shortcut
- Please Note: The crop values used by this macro are absolute! Running the macro a second time will not affect the image cumulatively.
- If the crop amount is not sufficient, we need to go back to the macro and make some changes.
- (In the Ribbon) View > Macros > View MacrosEdit
- This time, all we need to do is alter the crop valuesOnce completeSave in the top leftClose the window
- Run the macro again using your shortcut
Big thanks to Ameya Ramadurgakar for helping me with the Windows instructions.
Credit goes to Numerous Google search results for this solution, including this forum post