C# Snippets
AutoText_CanBeInserted
public bool AutoText_CanBeInserted(ref Word.Document objDocument, string sAutoTextName)
{
try
{
Tracer_Add2("SUBROUTINE", System.Reflection.MethodBase.GetCurrentMethod().Name + " start");
if (My.Settings.ERROR_OCCURRED == true)
return;
if (sAutoTextName.ToUpperInvariant().Contains("COVER") == false)
{
if (System.Convert.ToInt32(gApplicationWord.Selection.Information(Word.WdInformation.wdActiveEndPageNumber)) == 1)
{
System.Windows.Forms.MessageBox.Show("You cannot place this object on the first page.");
return true;
}
}
// If Era.WordUtils.SharedWordFunctions.EraTableCanBeInserted = False Then
// System.Windows.Forms.MessageBox.Show("The requested object cannot be inserted into protected regions, tables, headers/footers or frames.")
// Return True
// End If
return false;
}
catch (Exception ex)
{
modMessages.Exception(System.Reflection.MethodBase.GetCurrentMethod(), null/* TODO Change to default(_) if this is not a reference type */, ex);
}
}
Public Function AutoText_CanBeInserted(ByRef objDocument As Word.Document, _
ByVal sAutoTextName As String) As Boolean
Try
Call Tracer_Add2("SUBROUTINE", System.Reflection.MethodBase.GetCurrentMethod.Name & " start")
If My.Settings.ERROR_OCCURRED = True Then Exit Function
If sAutoTextName.ToUpperInvariant.Contains("COVER") = False Then
If CType(gApplicationWord.Selection.Information(Word.WdInformation.wdActiveEndPageNumber), Integer) = 1 Then
System.Windows.Forms.MessageBox.Show("You cannot place this object on the first page.")
Return True
End If
End If
'If Era.WordUtils.SharedWordFunctions.EraTableCanBeInserted = False Then
' System.Windows.Forms.MessageBox.Show("The requested object cannot be inserted into protected regions, tables, headers/footers or frames.")
' Return True
'End If
Return False
Catch ex As System.Exception
Call modMessages.Exception(System.Reflection.MethodBase.GetCurrentMethod, Nothing, ex)
End Try
End Function
AutoText_Exists
public bool AutoText_Exists(ref Word.Document objDocument, string sAutoTextName, Word.Range objRange = null/* TODO Change to default(_) if this is not a reference type */, bool bThisDocument = false)
{
Word.Template objTemplate = null/* TODO Change to default(_) if this is not a reference type */;
try
{
if (My.Settings.ERROR_OCCURRED == true)
return;
if ((objRange == null))
objRange = gApplicationWord.Selection.Range;
if ((AttachedTemplate_Exists(objDocument) == true))
{
if ((bThisDocument == false))
objTemplate = (Word.Template)objDocument.AttachedTemplate;
else
{
objDocument = modLateBinding.Return_ThisDocument();
objTemplate = (Word.Template)objDocument.AttachedTemplate;
}
return AutoText_ExistsForce(objDocument, objTemplate, sAutoTextName);
}
}
catch (Exception ex)
{
modMessages.ErrorMessage(System.Reflection.MethodBase.GetCurrentMethod(), null/* TODO Change to default(_) if this is not a reference type */, ex, "", false);
}
}
Public Function AutoText_Exists(ByRef objDocument As Word.Document, _
ByVal sAutoTextName As String, _
Optional ByVal objRange As Word.Range = Nothing, _
Optional ByVal bThisDocument As Boolean = False) _
As Boolean
Dim objTemplate As Word.Template = Nothing
Try
If My.Settings.ERROR_OCCURRED = True Then Exit Function
If (objRange Is Nothing) Then
objRange = gApplicationWord.Selection.Range
End If
If (AttachedTemplate_Exists(objDocument) = True) Then
If (bThisDocument = False) Then
objTemplate = CType(objDocument.AttachedTemplate, Word.Template)
Else
objDocument = modLateBinding.Return_ThisDocument()
objTemplate = CType(objDocument.AttachedTemplate, Word.Template)
End If
Return AutoText_ExistsForce(objDocument, objTemplate, sAutoTextName)
End If
Catch ex As Exception
Call modMessages.ErrorMessage(System.Reflection.MethodBase.GetCurrentMethod, Nothing, ex, _
"", False)
End Try
End Function
AutoText_ExistsForce
public bool AutoText_ExistsForce(ref Word.Document objDocument, Word.Template objTemplate, string sAutoTextName)
{
Word.AutoTextEntry objAutoTextEntry;
try
{
if (My.Settings.ERROR_OCCURRED == true)
return;
objAutoTextEntry = objTemplate.AutoTextEntries(sAutoTextName);
return true;
}
catch (Exception ex)
{
return false;
}
}
Public Function AutoText_ExistsForce(ByRef objDocument As Word.Document, _
ByVal objTemplate As Word.Template, _
ByVal sAutoTextName As String) As Boolean
Dim objAutoTextEntry As Word.AutoTextEntry
Try
If My.Settings.ERROR_OCCURRED = True Then Exit Function
objAutoTextEntry = objTemplate.AutoTextEntries(sAutoTextName)
Return True
Catch ex As Exception
Return False
End Try
End Function
AutoText_Insert
public void AutoText_Insert(ref Word.Document objDocument, Word.Template objTemplate, Word.Range objRange, string sAutoTextName, bool bCheckItExists = true)
{
Word.AutoTextEntry objAutoTextEntry;
try
{
Tracer_Add2("SUBROUTINE", System.Reflection.MethodBase.GetCurrentMethod().Name + " start");
if (My.Settings.ERROR_OCCURRED == true)
return;
if ((bCheckItExists == true))
{
if (modWordObjectModel.AutoText_Exists(objDocument, sAutoTextName) == false)
{
modMessages.AutoText_DoesNotExist(sAutoTextName, objTemplate.FullName);
return;
}
}
objAutoTextEntry = objTemplate.AutoTextEntries.Item(sAutoTextName);
objAutoTextEntry.Insert(objRange, true);
}
catch (Exception ex)
{
modMessages.Exception(System.Reflection.MethodBase.GetCurrentMethod(), null/* TODO Change to default(_) if this is not a reference type */, ex);
}
}
Public Sub AutoText_Insert(ByRef objDocument As Word.Document, _
ByVal objTemplate As Word.Template, _
ByVal objRange As Word.Range, _
ByVal sAutoTextName As String, _
Optional ByVal bCheckItExists As Boolean = True)
Dim objAutoTextEntry As Word.AutoTextEntry
Try
Call Tracer_Add2("SUBROUTINE", System.Reflection.MethodBase.GetCurrentMethod.Name & " start")
If My.Settings.ERROR_OCCURRED = True Then Exit Sub
If (bCheckItExists = True) Then
If modWordObjectModel.AutoText_Exists(objDocument, sAutoTextName) = False Then
Call modMessages.AutoText_DoesNotExist(sAutoTextName, objTemplate.FullName)
Exit Sub
End If
End If
objAutoTextEntry = objTemplate.AutoTextEntries.Item(sAutoTextName)
objAutoTextEntry.Insert(objRange, True)
Catch ex As Exception
Call modMessages.Exception(System.Reflection.MethodBase.GetCurrentMethod, Nothing, ex)
End Try
End Sub
AutoText_InsertPicture
public static Word.Shape Insert(string sAutoTextName, Word.Template objTemplate = null/* TODO Change to default(_) if this is not a reference type */, bool bReturnShape = false)
{
try
{
if (clsError.ErrorFlag() == true)
return;
if ((objTemplate == null))
objTemplate = (Word.Template)gApplicationWord.ActiveDocument.AttachedTemplate;
if (bReturnShape == true)
// if an object is a picture then this does not work !!
Insert = objTemplate.AutoTextEntries(sAutoTextName).Insert(Where: gApplicationWord.Selection.Range, RichText: true).ShapeRange(1);
else
objTemplate.AutoTextEntries(sAutoTextName).Insert(Where: gApplicationWord.Selection.Range, RichText: true);
}
catch (Runtime.InteropServices.COMException objCOMException)
{
mobjCOMException = objCOMException;
}
catch (Exception objException)
{
mobjException = objException;
}
finally
{
if (gbDEBUG_WORD == true | ((!mobjCOMException == null) | (!mobjException == null)))
clsError.Handle("Insert", msCLASSNAME, "insert the autotext entry '" + sAutoTextName + "' " + "from the attached template.", mobjCOMException, mobjException);
}
}
Public Shared Function Insert(ByVal sAutoTextName As String, _
Optional ByVal objTemplate As Word.Template = Nothing, _
Optional ByVal bReturnShape As Boolean = False) As Word.Shape
Try
If clsError.ErrorFlag() = True Then Exit Function
If (objTemplate Is Nothing) Then
objTemplate = CType(gApplicationWord.ActiveDocument.AttachedTemplate, Word.Template)
End If
If bReturnShape = True Then
'if an object is a picture then this does not work !!
Insert = objTemplate.AutoTextEntries(sAutoTextName).Insert( _
Where:=gApplicationWord.Selection.Range, _
RichText:=True).ShapeRange(1)
Else
objTemplate.AutoTextEntries(sAutoTextName).Insert( _
Where:=gApplicationWord.Selection.Range, _
RichText:=True)
End If
Catch objCOMException As System.Runtime.InteropServices.COMException
mobjCOMException = objCOMException
Catch objException As Exception
mobjException = objException
Finally
If gbDEBUG_WORD = True Or _
((Not mobjCOMException Is Nothing) Or (Not mobjException Is Nothing)) Then
Call clsError.Handle("Insert", msCLASSNAME, _
"insert the autotext entry '" & sAutoTextName & "' " & _
"from the attached template.", _
mobjCOMException, mobjException)
End If
End Try
End Function
Message_AutoTextDoesNotExist
public void AutoText_DoesNotExist(string sAutoTextName, string sFullPath)
{
string smessage = "";
smessage = "The Autotext '" + sAutoTextName + "' does not exist in the following document or template." + System.Environment.NewLine + System.Environment.NewLine + "'" + sFullPath + "'";
System.Windows.Forms.MessageBox.Show(smessage, My.Settings.APP_WINFORMS_TITLE, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Information);
smessage = smessage + " (" + System.Reflection.MethodBase.GetCurrentMethod().Name + ")";
Tracer_Add2("MESSAGE", smessage.Replace(System.Environment.NewLine, " ").Replace(" ", " "));
}
Public Sub AutoText_DoesNotExist(ByVal sAutoTextName As String, _
ByVal sFullPath As String)
Dim smessage As String = ""
smessage = "The Autotext '" & sAutoTextName & "' does not exist in the following document or template." & _
System.Environment.NewLine & _
System.Environment.NewLine & _
"'" & sFullPath & "'"
System.Windows.Forms.MessageBox.Show(smessage, _
My.Settings.APP_WINFORMS_TITLE, _
System.Windows.Forms.MessageBoxButtons.OK, _
System.Windows.Forms.MessageBoxIcon.Information)
smessage = smessage & " (" & System.Reflection.MethodBase.GetCurrentMethod.Name & ")"
Call Tracer_Add2("MESSAGE", smessage.Replace(System.Environment.NewLine, " ").Replace(" ", " "))
End Sub
Placeholders_Insert
public void Placeholders_Insert(ref Word.Document objDocument, string sPlaceholderType, string sPlaceholderPosition, string sPlaceholderWidth, string sPageSize = "A4")
{
try
{
if (My.Settings.ERROR_OCCURRED == true)
return;
switch (sPlaceholderType)
{
case "Single":
{
PlaceholdersInsert_Single(objDocument, sPlaceholderPosition, sPlaceholderWidth, sPageSize);
break;
}
case "2SideBySide":
{
PlaceholdersInsert_2SideBySide(objDocument, sPlaceholderPosition, sPlaceholderWidth, sPageSize);
break;
}
case "3SideBySide":
{
PlaceholdersInsert_3SideBySide(objDocument, sPlaceholderPosition, sPlaceholderWidth, sPageSize);
break;
}
case "Multiple":
{
PlaceholdersInsert_Multiple(objDocument, sPlaceholderPosition, sPlaceholderWidth, sPageSize);
break;
}
}
}
catch (Exception ex)
{
modMessages.ErrorMessage(System.Reflection.MethodBase.GetCurrentMethod(), null/* TODO Change to default(_) if this is not a reference type */, ex, "", false);
}
}
Public Sub Placeholders_Insert(ByRef objDocument As Word.Document, _
ByVal sPlaceholderType As String, _
ByVal sPlaceholderPosition As String, _
ByVal sPlaceholderWidth As String, _
Optional ByVal sPageSize As String = "A4")
Try
If My.Settings.ERROR_OCCURRED = True Then Exit Sub
Select Case sPlaceholderType
Case "Single" : Call PlaceholdersInsert_Single(objDocument, sPlaceholderPosition, sPlaceholderWidth, sPageSize)
Case "2SideBySide" : Call PlaceholdersInsert_2SideBySide(objDocument, sPlaceholderPosition, sPlaceholderWidth, sPageSize)
Case "3SideBySide" : Call PlaceholdersInsert_3SideBySide(objDocument, sPlaceholderPosition, sPlaceholderWidth, sPageSize)
Case "Multiple" : Call PlaceholdersInsert_Multiple(objDocument, sPlaceholderPosition, sPlaceholderWidth, sPageSize)
End Select
Catch ex As System.Exception
Call modMessages.ErrorMessage(System.Reflection.MethodBase.GetCurrentMethod, Nothing, ex, _
"", False)
End Try
End Sub
Placeholders_Insert_2SideBySide
public void PlaceholdersInsert_2SideBySide(ref Word.Document oDocument, string sPlaceholderPosition, string sPlaceholderWidth, string sPageSize)
{
try
{
if (My.Settings.ERROR_OCCURRED == true)
return;
switch (sPlaceholderWidth)
{
case "Indented":
{
switch (sPlaceholderPosition)
{
case "Current":
{
break;
}
case "Top of Page":
{
break;
}
case "Bottom of Page":
{
break;
}
case "Whole Page":
{
break;
}
}
break;
}
case "Full Width":
{
switch (sPlaceholderPosition)
{
case "Current":
{
AutoText_Insert(oDocument, "BC-Side by Side: current position", false);
break;
}
case "Top of Page":
{
break;
}
case "Bottom of Page":
{
AutoText_Insert(oDocument, "BC-Side by Side: bottom page", false);
break;
}
case "Whole Page":
{
break;
}
}
break;
}
case "Landscape":
{
switch (sPlaceholderPosition)
{
case "Current":
{
AutoText_Insert(oDocument, "BC-LScp-Side by Side: CP", false);
break;
}
case "Top of Page":
{
break;
}
case "Bottom of Page":
{
AutoText_Insert(oDocument, "BC-LScp-Side by Side: BP", false);
break;
}
case "Whole Page":
{
AutoText_Insert(oDocument, "BC-LScp-Side by Side: FP", false);
break;
}
}
break;
}
case "Slide":
{
switch (sPlaceholderPosition)
{
case "Current":
{
AutoText_Insert(oDocument, "BC-LScp-Side by Side: CP S", false);
break;
}
case "Top of Page":
{
break;
}
case "Bottom of Page":
{
AutoText_Insert(oDocument, "BC-LScp-Side by Side: BP S", false);
break;
}
case "Whole Page":
{
AutoText_Insert(oDocument, "BC-LScp-Side by Side: FP S", false);
break;
}
}
break;
}
}
}
catch (Exception ex)
{
modMessages.ErrorMessage(System.Reflection.MethodBase.GetCurrentMethod(), null/* TODO Change to default(_) if this is not a reference type */, ex, "", false);
}
}
Public Sub PlaceholdersInsert_2SideBySide(ByRef oDocument As Word.Document, _
ByVal sPlaceholderPosition As String, _
ByVal sPlaceholderWidth As String, _
ByVal sPageSize As String)
Try
If My.Settings.ERROR_OCCURRED = True Then Exit Sub
Select Case sPlaceholderWidth
Case "Indented"
Select Case sPlaceholderPosition
Case "Current"
Case "Top of Page"
Case "Bottom of Page"
Case "Whole Page"
End Select
Case "Full Width"
Select Case sPlaceholderPosition
'n is missing from autotext entry
Case "Current" :
Call AutoText_Insert(oDocument, "BC-Side by Side: current position", False)
Case "Top of Page"
Case "Bottom of Page" :
Call AutoText_Insert(oDocument, "BC-Side by Side: bottom page", False)
Case "Whole Page"
End Select
Case "Landscape"
Select Case sPlaceholderPosition
Case "Current" :
Call AutoText_Insert(oDocument, "BC-LScp-Side by Side: CP", False)
Case "Top of Page"
Case "Bottom of Page" :
Call AutoText_Insert(oDocument, "BC-LScp-Side by Side: BP", False)
Case "Whole Page" :
Call AutoText_Insert(oDocument, "BC-LScp-Side by Side: FP", False)
End Select
Case "Slide"
Select Case sPlaceholderPosition
Case "Current" :
Call AutoText_Insert(oDocument, "BC-LScp-Side by Side: CP S", False)
Case "Top of Page"
Case "Bottom of Page" :
Call AutoText_Insert(oDocument, "BC-LScp-Side by Side: BP S", False)
Case "Whole Page" :
Call AutoText_Insert(oDocument, "BC-LScp-Side by Side: FP S", False)
End Select
End Select
Catch ex As System.Exception
Call modMessages.ErrorMessage(System.Reflection.MethodBase.GetCurrentMethod, Nothing, ex, _
"", False)
End Try
End Sub
Placeholders_Insert_3SideBySide
public void PlaceholdersInsert_3SideBySide(ref Word.Document objDocument, string sPlaceholderPosition, string sPlaceholderWidth, string sPageSize)
{
try
{
if (My.Settings.ERROR_OCCURRED == true)
return;
switch (sPlaceholderWidth)
{
case "Indented":
{
break;
}
case "Full Width":
{
break;
}
case "Landscape":
{
switch (sPlaceholderPosition)
{
case "Current":
{
AutoText_Insert(objDocument, "BC-LScp-3 SS CP", false);
break;
}
case "Top of Page":
{
break;
}
case "Bottom of Page":
{
AutoText_Insert(objDocument, "BC-LScp-3 SS BP", false);
break;
}
case "Full Page":
{
break;
}
}
break;
}
case "Slide":
{
switch (sPlaceholderPosition)
{
case "Current":
{
AutoText_Insert(objDocument, "BC-LScp-3 SS CP S", false);
break;
}
case "Top of Page":
{
break;
}
case "Bottom of Page":
{
AutoText_Insert(objDocument, "BC-LScp-3 SS BP S", false);
break;
}
case "Full Page":
{
break;
}
}
break;
}
}
}
catch (Exception ex)
{
modMessages.ErrorMessage(System.Reflection.MethodBase.GetCurrentMethod(), null/* TODO Change to default(_) if this is not a reference type */, ex, "", false);
}
}
Public Sub PlaceholdersInsert_3SideBySide(ByRef objDocument As Word.Document, _
ByVal sPlaceholderPosition As String, _
ByVal sPlaceholderWidth As String, _
ByVal sPageSize As String)
Try
If My.Settings.ERROR_OCCURRED = True Then Exit Sub
Select Case sPlaceholderWidth
Case "Indented"
Case "Full Width"
Case "Landscape"
Select Case sPlaceholderPosition
Case "Current" :
Call AutoText_Insert(objDocument, "BC-LScp-3 SS CP", False)
Case "Top of Page"
Case "Bottom of Page" :
Call AutoText_Insert(objDocument, "BC-LScp-3 SS BP", False)
Case "Full Page"
End Select
Case "Slide"
Select Case sPlaceholderPosition
Case "Current" :
Call AutoText_Insert(objDocument, "BC-LScp-3 SS CP S", False)
Case "Top of Page"
Case "Bottom of Page" :
Call AutoText_Insert(objDocument, "BC-LScp-3 SS BP S", False)
Case "Full Page"
End Select
End Select
Catch ex As System.Exception
Call modMessages.ErrorMessage(System.Reflection.MethodBase.GetCurrentMethod, Nothing, ex, _
"", False)
End Try
End Sub
Placeholders_Insert_Multiple
public void PlaceholdersInsert_Multiple(ref Word.Document oDocument, string sPlaceholderPosition, string sPlaceholderWidth, string sPageSize)
{
try
{
if (My.Settings.ERROR_OCCURRED == true)
return;
switch (sPlaceholderWidth)
{
case "Indented":
{
break;
}
case "Full Width":
{
break;
}
case "Landscape":
{
switch (sPlaceholderPosition)
{
case "1 over 1":
{
AutoText_Insert(oDocument, "BC-LScp-1 over 1", false);
break;
}
case "1 over 2":
{
AutoText_Insert(oDocument, "BC-LScp-1 over 2", false);
break;
}
case "1 over 3":
{
AutoText_Insert(oDocument, "BC-LScp-1 over 3", false);
break;
}
case "2 over 1":
{
AutoText_Insert(oDocument, "BC-LScp-2 over 1", false);
break;
}
case "2 over 2":
{
AutoText_Insert(oDocument, "BC-LScp-2 over 2", false);
break;
}
case "3 over 1":
{
AutoText_Insert(oDocument, "BC-LScp-3 over 1", false);
break;
}
case "3 over 3":
{
AutoText_Insert(oDocument, "BC-LScp-3 over 3 SS CP", false);
break;
}
case "3 over 3 with Bullets":
{
AutoText_Insert(oDocument, "BC-LScp-3 over 3 SS CP Bull", false);
break;
}
case "1 Left 2 Right":
{
AutoText_Insert(oDocument, "BC-LScp-1 Left and 2 Right", false);
break;
}
case "2 Left 1 Right":
{
AutoText_Insert(oDocument, "BC-LScp-2 Left and 1 Right", false);
break;
}
}
break;
}
case "Slide":
{
switch (sPlaceholderPosition)
{
case "1 over 1":
{
AutoText_Insert(oDocument, "BC-LScp-1 over 1 S", false);
break;
}
case "1 over 2":
{
AutoText_Insert(oDocument, "BC-LScp-1 over 2 S", false);
break;
}
case "1 over 3":
{
AutoText_Insert(oDocument, "BC-LScp-1 over 3 S", false);
break;
}
case "2 over 1":
{
AutoText_Insert(oDocument, "BC-LScp-2 over 1 S", false);
break;
}
case "2 over 2":
{
AutoText_Insert(oDocument, "BC-LScp-2 over 2 S", false);
break;
}
case "3 over 1":
{
AutoText_Insert(oDocument, "BC-LScp-3 over 1 S", false);
break;
}
case "3 over 3":
{
AutoText_Insert(oDocument, "BC-LScp-3 over 3 SS CP S", false);
break;
}
case "3 over 3 with Bullets":
{
AutoText_Insert(oDocument, "BC-LScp-3 over 3 SS CP Bull S", false);
break;
}
case "1 Left 2 Right":
{
AutoText_Insert(oDocument, "BC-LScp-1 Left and 2 Right S", false);
break;
}
case "2 Left 1 Right":
{
AutoText_Insert(oDocument, "BC-LScp-2 Left and 1 Right S", false);
break;
}
}
break;
}
}
}
catch (Exception ex)
{
modMessages.ErrorMessage(System.Reflection.MethodBase.GetCurrentMethod(), null/* TODO Change to default(_) if this is not a reference type */, ex, "", false);
}
}
Public Sub PlaceholdersInsert_Multiple(ByRef oDocument As Word.Document, _
ByVal sPlaceholderPosition As String, _
ByVal sPlaceholderWidth As String, _
ByVal sPageSize As String)
Try
If My.Settings.ERROR_OCCURRED = True Then Exit Sub
Select Case sPlaceholderWidth
Case "Indented"
Case "Full Width"
Case "Landscape"
Select Case sPlaceholderPosition
Case "1 over 1" :
Call AutoText_Insert(oDocument, "BC-LScp-1 over 1", False)
Case "1 over 2" :
Call AutoText_Insert(oDocument, "BC-LScp-1 over 2", False)
Case "1 over 3" :
Call AutoText_Insert(oDocument, "BC-LScp-1 over 3", False)
Case "2 over 1" :
Call AutoText_Insert(oDocument, "BC-LScp-2 over 1", False)
Case "2 over 2" :
Call AutoText_Insert(oDocument, "BC-LScp-2 over 2", False)
Case "3 over 1" :
Call AutoText_Insert(oDocument, "BC-LScp-3 over 1", False)
Case "3 over 3" :
Call AutoText_Insert(oDocument, "BC-LScp-3 over 3 SS CP", False)
Case "3 over 3 with Bullets" :
Call AutoText_Insert(oDocument, "BC-LScp-3 over 3 SS CP Bull", False)
Case "1 Left 2 Right" :
Call AutoText_Insert(oDocument, "BC-LScp-1 Left and 2 Right", False)
Case "2 Left 1 Right" :
Call AutoText_Insert(oDocument, "BC-LScp-2 Left and 1 Right", False)
End Select
Case "Slide"
Select Case sPlaceholderPosition
Case "1 over 1" :
Call AutoText_Insert(oDocument, "BC-LScp-1 over 1 S", False)
Case "1 over 2" :
Call AutoText_Insert(oDocument, "BC-LScp-1 over 2 S", False)
Case "1 over 3" :
Call AutoText_Insert(oDocument, "BC-LScp-1 over 3 S", False)
Case "2 over 1" :
Call AutoText_Insert(oDocument, "BC-LScp-2 over 1 S", False)
Case "2 over 2" :
Call AutoText_Insert(oDocument, "BC-LScp-2 over 2 S", False)
Case "3 over 1" :
Call AutoText_Insert(oDocument, "BC-LScp-3 over 1 S", False)
Case "3 over 3" :
Call AutoText_Insert(oDocument, "BC-LScp-3 over 3 SS CP S", False)
Case "3 over 3 with Bullets" :
Call AutoText_Insert(oDocument, "BC-LScp-3 over 3 SS CP Bull S", False)
Case "1 Left 2 Right" :
Call AutoText_Insert(oDocument, "BC-LScp-1 Left and 2 Right S", False)
Case "2 Left 1 Right" :
Call AutoText_Insert(oDocument, "BC-LScp-2 Left and 1 Right S", False)
End Select
End Select
Catch ex As System.Exception
Call modMessages.ErrorMessage(System.Reflection.MethodBase.GetCurrentMethod, Nothing, ex, _
"", False)
End Try
End Sub
Placeholders_Insert_Single
public void PlaceholdersInsert_Single(ref Word.Document oDocument, string sPlaceholderPosition, string sPlaceholderWidth, string sPageSize)
{
try
{
if (My.Settings.ERROR_OCCURRED == true)
return;
switch (sPlaceholderWidth)
{
case "Indented":
{
switch (sPlaceholderPosition)
{
case "Current":
{
AutoText_Insert(oDocument, "BC-Chart Indented", false);
break;
}
case "Top of Page":
{
break;
}
case "Bottom of Page":
{
AutoText_Insert(oDocument, "BC-Chart Indented: bottom page", false);
break;
}
case "Whole Page":
{
break;
}
}
break;
}
case "Full Width":
{
switch (sPlaceholderPosition)
{
case "Current":
{
AutoText_Insert(oDocument, "BC-Chart Wide", false);
break;
}
case "Top of Page":
{
break;
}
case "Bottom of Page":
{
AutoText_Insert(oDocument, "BC-Chart Wide: bottom page", false);
break;
}
case "Whole Page":
{
break;
}
}
break;
}
case "Landscape":
{
switch (sPlaceholderPosition)
{
case "Current":
{
AutoText_Insert(oDocument, "BC-LScp-Chart Wide CP", false);
break;
}
case "Top of Page":
{
break;
}
case "Bottom of Page":
{
AutoText_Insert(oDocument, "BC-LScp-Chart Wide BP", false);
break;
}
case "Whole Page":
{
AutoText_Insert(oDocument, "BC-LScp-Chart Wide FP", false);
break;
}
}
break;
}
case "Slide":
{
switch (sPlaceholderPosition)
{
case "Current":
{
AutoText_Insert(oDocument, "BC-LScp-Chart Wide CP S", false);
break;
}
case "Top of Page":
{
break;
}
case "Bottom of Page":
{
AutoText_Insert(oDocument, "BC-LScp-Chart Wide BP S", false);
break;
}
case "Whole Page":
{
AutoText_Insert(oDocument, "BC-LScp-Chart Wide FP S", false);
break;
}
}
break;
}
}
}
catch (Exception ex)
{
modMessages.ErrorMessage(System.Reflection.MethodBase.GetCurrentMethod(), null/* TODO Change to default(_) if this is not a reference type */, ex, "", false);
}
}
Public Sub PlaceholdersInsert_Single(ByRef oDocument As Word.Document, _
ByVal sPlaceholderPosition As String, _
ByVal sPlaceholderWidth As String, _
ByVal sPageSize As String)
Try
If My.Settings.ERROR_OCCURRED = True Then Exit Sub
Select Case sPlaceholderWidth
Case "Indented"
Select Case sPlaceholderPosition
Case "Current" :
Call AutoText_Insert(oDocument, "BC-Chart Indented", False)
Case "Top of Page"
Case "Bottom of Page" :
Call AutoText_Insert(oDocument, "BC-Chart Indented: bottom page", False)
Case "Whole Page"
End Select
Case "Full Width"
Select Case sPlaceholderPosition
Case "Current" :
Call AutoText_Insert(oDocument, "BC-Chart Wide", False)
Case "Top of Page"
Case "Bottom of Page" :
Call AutoText_Insert(oDocument, "BC-Chart Wide: bottom page", False)
Case "Whole Page"
End Select
Case "Landscape"
Select Case sPlaceholderPosition
Case "Current" :
Call AutoText_Insert(oDocument, "BC-LScp-Chart Wide CP", False)
Case "Top of Page"
Case "Bottom of Page" :
Call AutoText_Insert(oDocument, "BC-LScp-Chart Wide BP", False)
Case "Whole Page" :
Call AutoText_Insert(oDocument, "BC-LScp-Chart Wide FP", False)
End Select
Case "Slide"
Select Case sPlaceholderPosition
Case "Current" :
Call AutoText_Insert(oDocument, "BC-LScp-Chart Wide CP S", False)
Case "Top of Page"
Case "Bottom of Page" :
Call AutoText_Insert(oDocument, "BC-LScp-Chart Wide BP S", False)
Case "Whole Page" :
Call AutoText_Insert(oDocument, "BC-LScp-Chart Wide FP S", False)
End Select
End Select
Catch ex As System.Exception
Call modMessages.ErrorMessage(System.Reflection.MethodBase.GetCurrentMethod, Nothing, ex, _
"", False)
End Try
End Sub
© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited Top