I needed to find a way to export a number of pages from a OneNote notebook into Word documents. The technique I used and will step through in this post was to:
- Create a new OneNote section (temporarily in needed) to arrange the pages I wanted to export (one section per Word document I wanted)
- Export the entire section into a Word (*.docx) file
- Automatically fix up image sizing issues with a custom macro
Right-click on the section tab and select Export…
Change the export file type to be a Word document (*.docx)
This will export all pages from the OneNote section and append them all into one Word document. This is a pretty good result except for the pictures. In many cases the pictures are wider than the page width and look half missing.
The solution to quickly and easily address the image width problem in bulk is to create a Word macro to resize all images in a Word document that are too wide to fit on the page.
Here’s how we create the Word macro (this is in Outlook 2016)
The Developer toolbar needed for creating macros isn’t visible by default so to switch it on to File | Options | Customize Ribbon and ensure Developer is checked
You should now get the Developer toolbar appearing
Select Macros, give the new macro a name and select a scope for where to save the macro (this determines where it will be available later on).
You will now be dropped into the VB Macro Editor experience which looks nothing like Word! Don’t worry you just need to paste the following code in as shown
Here’s the macro code to copy/paste
Dim i As Long With ActiveDocument For i = 1 To .InlineShapes.Count If PointsToCentimeters(.InlineShapes(i).Width) > 15 Then With .InlineShapes(i) .LockAspectRatio = msoTrue .Width = CentimetersToPoints(15) End With End If Next i End With
The result should look like this, you can then save and close the macro editor window
Now back in Word, with your document open (with the oversized images) select Developer | Macros, select your new macro and click Run
Once the macro has completed all the images that were over 15cm in width will have been resized to fit on the page.
This assumes the pages are in portrait orientation and that the maximum width of an image should be 15cm
External content types are defined through XML files referred to as “BDC metadata models”. These BDC metadata models can be created in both SharePoint Designer and Visual Studio. The technique used to create the BDC metadata models determines the technique used to export it.
- Models created using Visual Studio can be exported directly through the SharePoint UI in a browser (via the BDC service application).
- Models created using SharePoint Designer must be exported using SharePoint Designer
How to Export BDC Metadata Model using the BDC Service Application
Open SharePoint Central Administration | Application Management | Manage Service Applications
Select the Business Data Connectivity Service
Change the view drop-down to BDC Models
From the context menu on the BDC Model choose Export BDC Model
Ensure the file type is set to Model to Export
Select the save location. The exported file is an xml file saved with a .bdcm file extension (Visual Studio SharePoint BDC Designer File)
How to Export BDC Metadata Model using SharePoint Designer
Open the SharePoint site in SharePoint Designer and select External Content Types
Select the External Content Type and choose the Export BDC Model ribbon button
Provide a name for the exported model and the settings profile to export.
The settings refer to the Default and Client settings profiles under on the Connection Properties.
Select save location. The exported file is an xml file saved with a .bdcm file extension (Visual Studio SharePoint BDC Designer File)