8
8
import org.crosswire.common.util.LogicError;
11
* VBAExport takes a Map and exports the data to a Word VBA file.
12
* This was developed from a VB macro that looked something like this:
14
* Attribute VB_Name = "NumberLine"
18
* Dim shape As FreeformBuilder
20
* Private Const box_width As Single = 20#
21
* Private Const box_height As Single = 20#
24
* '-------------------------------------------------------------------------------
26
* Public Sub RouteMain()
28
* RouteStart 100#, 100#, "1"
30
* RouteContinue 110#, 110#, "2"
31
* RouteContinue 120#, 120#, "3"
32
* RouteContinue 130#, 120#, "4"
33
* RouteContinue 130#, 130#, "5"
34
* RouteContinue 100#, 130#, "6"
35
* RouteContinue 90#, 100#, "7"
42
* '-------------------------------------------------------------------------------
44
* Private Sub RouteStart(x As Single, y As Single, display As String)
46
* Set shape = ActiveDocument.Shapes.BuildFreeform(msoEditingAuto, x, y)
47
* RouteAddText x, y, display
52
* '-------------------------------------------------------------------------------
54
* Private Sub RouteContinue(x As Single, y As Single, display As String)
56
* shape.AddNodes msoSegmentLine, msoEditingAuto, x, y
57
* RouteAddText x, y, display
62
* '-------------------------------------------------------------------------------
64
* Private Sub RouteEnd()
66
* Dim route As ShapeRange
68
* shape.ConvertToShape.Select
69
* Set route = Selection.ShapeRange
71
* route.Fill.Visible = msoFalse
72
* route.Fill.Transparency = 0#
73
* route.Line.Weight = 0.75
74
* route.Line.DashStyle = msoLineSolid
75
* route.Line.Style = msoLineSingle
76
* route.Line.Transparency = 0#
77
* route.Line.Visible = msoTrue
78
* route.Line.ForeColor.RGB = RGB(255, 0, 0)
79
* route.Line.BackColor.RGB = RGB(255, 255, 255)
80
* route.Line.BeginArrowheadLength = msoArrowheadLengthMedium
81
* route.Line.BeginArrowheadWidth = msoArrowheadWidthMedium
82
* route.Line.BeginArrowheadStyle = msoArrowheadNone
83
* route.Line.EndArrowheadLength = msoArrowheadLengthMedium
84
* route.Line.EndArrowheadWidth = msoArrowheadWidthMedium
85
* route.Line.EndArrowheadStyle = msoArrowheadNone
87
* 'route.LockAspectRatio = msoFalse
88
* 'route.Height = 115.35
89
* 'route.Width = 333.05
90
* 'route.Rotation = 0#
91
* 'route.RelativeHorizontalPosition = wdRelativeHorizontalPositionColumn
92
* 'route.RelativeVerticalPosition = wdRelativeVerticalPositionParagraph
94
* 'route.LockAnchor = False
95
* 'route.WrapFormat.AllowOverlap = True
96
* 'route.WrapFormat.Side = wdWrapBoth
97
* 'route.WrapFormat.DistanceTop = CentimetersToPoints(0)
98
* 'route.WrapFormat.DistanceBottom = CentimetersToPoints(0)
99
* 'route.WrapFormat.DistanceLeft = CentimetersToPoints(0.32)
100
* 'route.WrapFormat.DistanceRight = CentimetersToPoints(0.32)
101
* 'route.WrapFormat.Type = 3
103
* route.ZOrder msoSendToBack
104
* route.IncrementLeft box_width / 2
105
* route.IncrementTop box_height / 2
110
* '-------------------------------------------------------------------------------
112
* Private Sub RouteAddText(x As Single, y As Single, display As String)
116
* Set box = ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, x, y, box_width, box_width)
118
* box.TextFrame.TextRange.Text = display
119
* box.Fill.Visible = msoFalse
120
* box.Fill.Transparency = 0#
121
* box.Line.Weight = 0.75
122
* box.Line.DashStyle = msoLineSolid
123
* box.Line.Style = msoLineSingle
124
* box.Line.Transparency = 0#
125
* box.Line.Visible = msoFalse
127
* 'box.ScaleWidth 0.38, msoFalse, msoScaleFromTopLeft
128
* 'box.ScaleHeight 0.25, msoFalse, msoScaleFromTopLeft
130
* 'box.LockAspectRatio = msoFalse
131
* 'box.RelativeHorizontalPosition = wdRelativeHorizontalPositionColumn
132
* 'box.RelativeVerticalPosition = wdRelativeVerticalPositionParagraph
133
* 'box.LockAnchor = False
135
* 'box.WrapFormat.AllowOverlap = True
136
* 'box.WrapFormat.Side = wdWrapBoth
137
* 'box.WrapFormat.DistanceTop = CentimetersToPoints(0)
138
* 'box.WrapFormat.DistanceBottom = CentimetersToPoints(0)
139
* 'box.WrapFormat.DistanceLeft = CentimetersToPoints(0.32)
140
* 'box.WrapFormat.DistanceRight = CentimetersToPoints(0.32)
141
* 'box.WrapFormat.Type = 3
145
* 'box.TextFrame.MarginLeft = 7.09
146
* 'box.TextFrame.MarginRight = 7.09
147
* 'box.TextFrame.MarginTop = 3.69
148
* 'box.TextFrame.MarginBottom = 3.69
150
* 'box.IncrementLeft 47.7
151
* 'box.IncrementTop 47.7
152
* 'box.Left = CentimetersToPoints(1)
153
* 'box.Top = CentimetersToPoints(0.23)
154
* 'box.Height = 18.15
159
* '-------------------------------------------------------------------------------
162
* <table border='1' cellPadding='3' cellSpacing='0' width="100%">
163
* <tr><td bgColor='white'class='TableRowColor'><font size='-7'>
164
* Distribution Licence:<br />
165
* Project B is free software; you can redistribute it
166
* and/or modify it under the terms of the GNU General Public License,
167
* version 2 as published by the Free Software Foundation.<br />
168
* This program is distributed in the hope that it will be useful,
169
* but WITHOUT ANY WARRANTY; without even the implied warranty of
170
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
171
* General Public License for more details.<br />
172
* The License is available on the internet
173
* <a href='http://www.gnu.org/copyleft/gpl.html'>here</a>, by writing to
174
* <i>Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
175
* MA 02111-1307, USA</i>, Or locally at the Licence link below.<br />
176
* The copyright to this program is held by it's authors.
177
* </font></td></tr></table>
178
* @see <a href='http://www.eireneh.com/servlets/Web'>Project B Home</a>
179
* @see <{docs.Licence}>
11
* VBAExport takes a Map and exports the data to a Word VBA file.
12
* This was developed from a VB macro that looked something like this:
14
* Attribute VB_Name = "NumberLine"
18
* Dim shape As FreeformBuilder
20
* Private Const box_width As Single = 20#
21
* Private Const box_height As Single = 20#
24
* '-------------------------------------------------------------------------------
26
* Public Sub RouteMain()
28
* RouteStart 100#, 100#, "1"
30
* RouteContinue 110#, 110#, "2"
31
* RouteContinue 120#, 120#, "3"
32
* RouteContinue 130#, 120#, "4"
33
* RouteContinue 130#, 130#, "5"
34
* RouteContinue 100#, 130#, "6"
35
* RouteContinue 90#, 100#, "7"
42
* '-------------------------------------------------------------------------------
44
* Private Sub RouteStart(x As Single, y As Single, display As String)
46
* Set shape = ActiveDocument.Shapes.BuildFreeform(msoEditingAuto, x, y)
47
* RouteAddText x, y, display
52
* '-------------------------------------------------------------------------------
54
* Private Sub RouteContinue(x As Single, y As Single, display As String)
56
* shape.AddNodes msoSegmentLine, msoEditingAuto, x, y
57
* RouteAddText x, y, display
62
* '-------------------------------------------------------------------------------
64
* Private Sub RouteEnd()
66
* Dim route As ShapeRange
68
* shape.ConvertToShape.Select
69
* Set route = Selection.ShapeRange
71
* route.Fill.Visible = msoFalse
72
* route.Fill.Transparency = 0#
73
* route.Line.Weight = 0.75
74
* route.Line.DashStyle = msoLineSolid
75
* route.Line.Style = msoLineSingle
76
* route.Line.Transparency = 0#
77
* route.Line.Visible = msoTrue
78
* route.Line.ForeColor.RGB = RGB(255, 0, 0)
79
* route.Line.BackColor.RGB = RGB(255, 255, 255)
80
* route.Line.BeginArrowheadLength = msoArrowheadLengthMedium
81
* route.Line.BeginArrowheadWidth = msoArrowheadWidthMedium
82
* route.Line.BeginArrowheadStyle = msoArrowheadNone
83
* route.Line.EndArrowheadLength = msoArrowheadLengthMedium
84
* route.Line.EndArrowheadWidth = msoArrowheadWidthMedium
85
* route.Line.EndArrowheadStyle = msoArrowheadNone
87
* 'route.LockAspectRatio = msoFalse
88
* 'route.Height = 115.35
89
* 'route.Width = 333.05
90
* 'route.Rotation = 0#
91
* 'route.RelativeHorizontalPosition = wdRelativeHorizontalPositionColumn
92
* 'route.RelativeVerticalPosition = wdRelativeVerticalPositionParagraph
94
* 'route.LockAnchor = False
95
* 'route.WrapFormat.AllowOverlap = True
96
* 'route.WrapFormat.Side = wdWrapBoth
97
* 'route.WrapFormat.DistanceTop = CentimetersToPoints(0)
98
* 'route.WrapFormat.DistanceBottom = CentimetersToPoints(0)
99
* 'route.WrapFormat.DistanceLeft = CentimetersToPoints(0.32)
100
* 'route.WrapFormat.DistanceRight = CentimetersToPoints(0.32)
101
* 'route.WrapFormat.Type = 3
103
* route.ZOrder msoSendToBack
104
* route.IncrementLeft box_width / 2
105
* route.IncrementTop box_height / 2
110
* '-------------------------------------------------------------------------------
112
* Private Sub RouteAddText(x As Single, y As Single, display As String)
116
* Set box = ActiveDocument.Shapes.AddTextbox(msoTextOrientationHorizontal, x, y, box_width, box_width)
118
* box.TextFrame.TextRange.Text = display
119
* box.Fill.Visible = msoFalse
120
* box.Fill.Transparency = 0#
121
* box.Line.Weight = 0.75
122
* box.Line.DashStyle = msoLineSolid
123
* box.Line.Style = msoLineSingle
124
* box.Line.Transparency = 0#
125
* box.Line.Visible = msoFalse
127
* 'box.ScaleWidth 0.38, msoFalse, msoScaleFromTopLeft
128
* 'box.ScaleHeight 0.25, msoFalse, msoScaleFromTopLeft
130
* 'box.LockAspectRatio = msoFalse
131
* 'box.RelativeHorizontalPosition = wdRelativeHorizontalPositionColumn
132
* 'box.RelativeVerticalPosition = wdRelativeVerticalPositionParagraph
133
* 'box.LockAnchor = False
135
* 'box.WrapFormat.AllowOverlap = True
136
* 'box.WrapFormat.Side = wdWrapBoth
137
* 'box.WrapFormat.DistanceTop = CentimetersToPoints(0)
138
* 'box.WrapFormat.DistanceBottom = CentimetersToPoints(0)
139
* 'box.WrapFormat.DistanceLeft = CentimetersToPoints(0.32)
140
* 'box.WrapFormat.DistanceRight = CentimetersToPoints(0.32)
141
* 'box.WrapFormat.Type = 3
145
* 'box.TextFrame.MarginLeft = 7.09
146
* 'box.TextFrame.MarginRight = 7.09
147
* 'box.TextFrame.MarginTop = 3.69
148
* 'box.TextFrame.MarginBottom = 3.69
150
* 'box.IncrementLeft 47.7
151
* 'box.IncrementTop 47.7
152
* 'box.Left = CentimetersToPoints(1)
153
* 'box.Top = CentimetersToPoints(0.23)
154
* 'box.Height = 18.15
159
* '-------------------------------------------------------------------------------
162
* <p><table border='1' cellPadding='3' cellSpacing='0'>
163
* <tr><td bgColor='white' class='TableRowColor'><font size='-7'>
165
* Distribution Licence:<br />
166
* JSword is free software; you can redistribute it
167
* and/or modify it under the terms of the GNU General Public License,
168
* version 2 as published by the Free Software Foundation.<br />
169
* This program is distributed in the hope that it will be useful,
170
* but WITHOUT ANY WARRANTY; without even the implied warranty of
171
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
172
* General Public License for more details.<br />
173
* The License is available on the internet
174
* <a href='http://www.gnu.org/copyleft/gpl.html'>here</a>, or by writing to:
175
* Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
176
* MA 02111-1307, USA<br />
177
* The copyright to this program is held by it's authors.
178
* </font></td></tr></table>
180
* @author Joe Walker [joe at eireneh dot com]
183
183
public class VBAExport