C# Snippets


Chart_Add

Add a chart providing the source data, chart type and location.
public Excel.Chart Chart_Add(long lTypeOfChart, string sColFirst, int iRowFirst, string sColLast, int iRowLast, bool bPlotByColumn = true, string sChartLocation = "Embedded Chart", string sPlaceCol = "", int iPlaceRow = 0, string sSourceWshName = "", string sChartWshName = "")
{
Excel.Worksheet objWorksheet;
Excel.Range objRange;
Excel.Chart objChart;
Excel.XlChartLocation objChartLocation;

try
{
if (clsError.ErrorFlag() == true)
return;

if (sChartWshName != "")
{
objWorksheet = (Excel.Worksheet)gApplication.Sheets(sChartWshName);
objWorksheet.Select();
}
if (sChartWshName == "")
{
objWorksheet = (Excel.Worksheet)gApplication.ActiveSheet;
sChartWshName = objWorksheet.Name;
}
if (sSourceWshName == "")
sSourceWshName = sChartWshName;

if (gbUPDATE_SCREEN == false)
gApplication.ScreenUpdating = false;
gApplication.Charts.Add();
objChart = (Excel.Chart)gApplication.ActiveChart;

objChart.ChartType = (Excel.XlChartType)lTypeOfChart;

// because Pie and Bubble charts create a chart title by default
objChart.HasTitle = false;

// defaults to columns !!!
objWorksheet = (Excel.Worksheet)gApplication.Sheets(sSourceWshName);
objRange = objWorksheet.Range(sColFirst + iRowFirst + ":" + sColLast + iRowLast);

objChart.SetSourceData(Source: objRange);

if (bPlotByColumn == true)
objChart.PlotBy = Excel.XlRowCol.xlColumns;
if (bPlotByColumn == false)
objChart.PlotBy = Excel.XlRowCol.xlRows;

if (sChartLocation == "Embedded Chart")
{
objChartLocation = Excel.XlChartLocation.xlLocationAsObject;
objChart.Location(Where: objChartLocation, Name: sChartWshName);
}

if (sChartLocation == "Chart Sheet")
{
objChartLocation = Excel.XlChartLocation.xlLocationAsNewSheet;
objChart.Location(Where: objChartLocation);

// change the view % on the chart sheet to 100% - maybe have option to change default
gApplication.ActiveWindow.Zoom = 100;
}

if (gbUPDATE_SCREEN == false)
gApplication.ScreenUpdating = true;

if (((sPlaceCol != "") & (iPlaceRow != 0)))
Chart_Move(sPlaceCol, iPlaceRow, Chart_NameReturn);

Chart_Add = objChart;
}

// include where to place the chart

catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
if (gbUPDATE_SCREEN == false)
gApplication.ScreenUpdating = true;

string serrortext;

objWorksheet = null/* TODO Change to default(_) if this is not a reference type */;
objRange = null/* TODO Change to default(_) if this is not a reference type */;
objChart = null/* TODO Change to default(_) if this is not a reference type */;

if (((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
{
gApplication.ScreenUpdating = true;
gApplication.DisplayAlerts = false;

if (TypeName(gApplication.ActiveSheet) == "Chart")
{
objWorksheet = (Excel.Worksheet)gApplication.ActiveSheet;
objWorksheet.Delete();
}

gApplication.DisplayAlerts = true;

if (sSourceWshName != "")
serrortext = sSourceWshName + "!";
serrortext = serrortext + sColFirst + iRowFirst + ":" + sColLast + iRowLast + "\" ";
if (sChartWshName == "")
serrortext = serrortext + "on the active worksheet";
if (sChartWshName != "")
serrortext = serrortext + "to the worksheet \"" + sChartWshName + "\"";
}

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("Chart_Add", msMODULENAME, "add a chart of type '" + lTypeOfChart + "'" + Constants.vbCrLf + "with the source data '" + serrortext + "'" + Constants.vbCrLf + "and place it at cell '" + sPlaceCol + iPlaceRow + "'." + " This may not be a valid chart type.", gobjCOMException, gobjException);
}
}
Add a chart providing the source data, chart type and location.
Public Function Chart_Add(ByVal lTypeOfChart As Long, _
ByVal sColFirst As String, _
ByVal iRowFirst As Integer, _
ByVal sColLast As String, _
ByVal iRowLast As Integer, _
Optional ByVal bPlotByColumn As Boolean = True, _
Optional ByVal sChartLocation As String = "Embedded Chart", _
Optional ByVal sPlaceCol As String = "", _
Optional ByVal iPlaceRow As Integer = 0, _
Optional ByVal sSourceWshName As String = "", _
Optional ByVal sChartWshName As String = "") _
As Excel.Chart

Dim objWorksheet As Excel.Worksheet
Dim objRange As Excel.Range
Dim objChart As Excel.Chart
Dim objChartLocation As Excel.XlChartLocation

Try
If clsError.ErrorFlag() = True Then Exit Function

If sChartWshName <> "" Then
objWorksheet = CType(gApplication.Sheets(sChartWshName), Excel.Worksheet)
objWorksheet.Select()
End If
If sChartWshName = "" Then
objWorksheet = CType(gApplication.ActiveSheet, Excel.Worksheet)
sChartWshName = objWorksheet.Name
End If
If sSourceWshName = "" Then sSourceWshName = sChartWshName

If gbUPDATE_SCREEN = False Then gApplication.ScreenUpdating = False
gApplication.Charts.Add()
objChart = CType(gApplication.ActiveChart, Excel.Chart)

objChart.ChartType = CType(lTypeOfChart, Excel.XlChartType)

'because Pie and Bubble charts create a chart title by default
objChart.HasTitle = False

'defaults to columns !!!
objWorksheet = CType(gApplication.Sheets(sSourceWshName), Excel.Worksheet)
objRange = objWorksheet.Range(sColFirst & iRowFirst & ":" & sColLast & iRowLast)

objChart.SetSourceData(Source:=objRange)

If bPlotByColumn = True Then objChart.PlotBy = Excel.XlRowCol.xlColumns
If bPlotByColumn = False Then objChart.PlotBy = Excel.XlRowCol.xlRows

If sChartLocation = "Embedded Chart" Then
objChartLocation = Excel.XlChartLocation.xlLocationAsObject
objChart.Location(Where:=objChartLocation, Name:=sChartWshName)
End If

If sChartLocation = "Chart Sheet" Then
objChartLocation = Excel.XlChartLocation.xlLocationAsNewSheet
objChart.Location(Where:=objChartLocation)

'change the view % on the chart sheet to 100% - maybe have option to change default
gApplication.ActiveWindow.Zoom = 100
End If

If gbUPDATE_SCREEN = False Then gApplication.ScreenUpdating = True

If ((sPlaceCol <> "") And (iPlaceRow <> 0)) Then
Call Chart_Move(sPlaceCol, iPlaceRow, Chart_NameReturn)
End If

Chart_Add = objChart

'include where to place the chart

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
If gbUPDATE_SCREEN = False Then gApplication.ScreenUpdating = True

Dim serrortext As String

objWorksheet = Nothing
objRange = Nothing
objChart = Nothing

If ((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

gApplication.ScreenUpdating = True
gApplication.DisplayAlerts = False

If TypeName(gApplication.ActiveSheet) = "Chart" Then
objWorksheet = CType(gApplication.ActiveSheet, Excel.Worksheet)
objWorksheet.Delete()
End If

gApplication.DisplayAlerts = True

If sSourceWshName <> "" Then serrortext = sSourceWshName & "!"
serrortext = _
serrortext & sColFirst & iRowFirst & ":" & sColLast & iRowLast & """ "
If sChartWshName = "" Then serrortext = serrortext & "on the active worksheet"
If sChartWshName <> "" Then _
serrortext = serrortext & "to the worksheet """ & sChartWshName & """"
End If

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("Chart_Add", msMODULENAME, _
"add a chart of type '" & lTypeOfChart & "'" & vbCrLf & _
"with the source data '" & serrortext & "'" & vbCrLf & _
"and place it at cell '" & sPlaceCol & iPlaceRow & "'." & _
" This may not be a valid chart type.", _
gobjCOMException, gobjException)
End If
End Try
End Function

Chart_Format

public void Chart_Format(Excel.Chart objChart, string sChartlocation = "Embedded Chart")
{
Excel.ChartArea objChartArea;
Excel.SeriesCollection objSeriesCol;
Excel.Series objSeries;

try
{
if (clsError.ErrorFlag() == true)
return;

string schartsize;
int iseriescount;
float sngfontsize;

if (gbUPDATE_SCREEN == false)
gApplication.ScreenUpdating = false;

// need to check the number of series and display a message if too many !!

// define the palette colours for the series
Colour_SeriesIndexDefine();

objChartArea = objChart.ChartArea;
objSeriesCol = (Excel.SeriesCollection)objChart.SeriesCollection;

if (sChartlocation == "Embedded Chart")
{
schartsize = App_ChartSizeReturn(objChart);
sngfontsize = App_ChartFontSize(schartsize);
}
else
{
// otherwise must be "Chart Sheet"
sngfontsize = 14;

// purely for testing !!!
gbUPDATE_SCREEN = false;
}

Chart_AreaFormat(objChart, gsDEF_FONTNAME, sngfontsize, giDEF_FONTCOLOUR_PALETTE, gsDEF_FONTBACKGROUND, gbDEF_FONTBOLD, null/* Conversion error: Set to default value for this argument */, null/* Conversion error: Set to default value for this argument */, null/* Conversion error: Set to default value for this argument */, null/* Conversion error: Set to default value for this argument */, null/* Conversion error: Set to default value for this argument */, null/* Conversion error: Set to default value for this argument */, null/* Conversion error: Set to default value for this argument */, null/* Conversion error: Set to default value for this argument */, null/* Conversion error: Set to default value for this argument */, giDEF_PALETTEWHITE);

Chart_PlotAreaFormat(objChart, null/* Conversion error: Set to default value for this argument */, null/* Conversion error: Set to default value for this argument */, null/* Conversion error: Set to default value for this argument */, giDEF_PALETTEWHITE);

Chart_LegendFormat(objChart, gsDEF_FONTNAME, sngfontsize, giDEF_FONTCOLOUR_PALETTE, gsDEF_FONTBACKGROUND, null/* Conversion error: Set to default value for this argument */, null/* Conversion error: Set to default value for this argument */, null/* Conversion error: Set to default value for this argument */, null/* Conversion error: Set to default value for this argument */, null/* Conversion error: Set to default value for this argument */, null/* Conversion error: Set to default value for this argument */, null/* Conversion error: Set to default value for this argument */, null/* Conversion error: Set to default value for this argument */, null/* Conversion error: Set to default value for this argument */, null/* Conversion error: Set to default value for this argument */, giDEF_PALETTEWHITE);

Chart_PlotAreaSizeMove(objChart, objChartArea.Width, 1, objChartArea.Height, 1);

Chart_TitleSizePosition(objChart, null/* Conversion error: Set to default value for this argument */, sngfontsize);
Chart_LegendSizePosition(objChart, null/* Conversion error: Set to default value for this argument */, sngfontsize);

if (Chart_AxesExists(objChart, "P", "C") == true)
{
Chart_AxesTitleSizePosition(objChart, "P", "C");
Chart_AxesFormat(objChart, "P", "C");
Chart_AxesXOptions(objChart, "P", "C");
}

if (Chart_AxesExists(objChart, "P", "V") == true)
{
Chart_AxesTitleSizePosition(objChart, "P", "V");
Chart_AxesFormat(objChart, "P", "V");
Chart_AxesXOptions(objChart, "P", "V");

Chart_AxesYScaleAdjustToRP(objChart, "P", "V", false, true);
}

if (Chart_AxesExists(objChart, "S", "C") == true)
{
Chart_AxesTitleSizePosition(objChart, "S", "C");
Chart_AxesFormat(objChart, "S", "C");
Chart_AxesXOptions(objChart, "S", "C");
}
if (Chart_AxesExists(objChart, "S", "V") == true)
{
Chart_AxesTitleSizePosition(objChart, "S", "V");
Chart_AxesFormat(objChart, "S", "V");
Chart_AxesXOptions(objChart, "S", "V");

Chart_AxesYScaleAdjustToRP(objChart, "S", "V", false, true);
}

for (iseriescount = 1; iseriescount <= objSeriesCol.Count; iseriescount++)
{
if (clszLateBindingExcel.ChartSeriesValid(objSeriesCol, iseriescount) == true)
{
objSeries = objSeriesCol.Item(iseriescount);

ChartType_SeriesFormatLineOrArea(objChart, objSeries, iseriescount);

ChartType_SeriesFormat(objChart, "", objSeries, iseriescount);
}
}


// purely for testing !!! to stop flickering with Chart Sheets
gbUPDATE_SCREEN = true;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
if (gbUPDATE_SCREEN == false)
gApplication.ScreenUpdating = true;

objChart = null/* TODO Change to default(_) if this is not a reference type */;
objChartArea = null/* TODO Change to default(_) if this is not a reference type */;
objSeriesCol = null/* TODO Change to default(_) if this is not a reference type */;
objSeries = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("Chart_Format", msMODULENAME, "format the chart completely.", gobjCOMException, gobjException);
}
}
Public Sub Chart_Format(ByVal objChart As Excel.Chart, _
Optional ByVal sChartlocation As String = "Embedded Chart")

Dim objChartArea As Excel.ChartArea
Dim objSeriesCol As Excel.SeriesCollection
Dim objSeries As Excel.Series

Try
If clsError.ErrorFlag() = True Then Exit Sub

Dim schartsize As String
Dim iseriescount As Integer
Dim sngfontsize As Single

If gbUPDATE_SCREEN = False Then gApplication.ScreenUpdating = False

'need to check the number of series and display a message if too many !!

'define the palette colours for the series
Call Colour_SeriesIndexDefine()

objChartArea = objChart.ChartArea
objSeriesCol = CType(objChart.SeriesCollection, Excel.SeriesCollection)

If sChartlocation = "Embedded Chart" Then
schartsize = App_ChartSizeReturn(objChart)
sngfontsize = App_ChartFontSize(schartsize)
Else
'otherwise must be "Chart Sheet"
sngfontsize = 14

'purely for testing !!!
gbUPDATE_SCREEN = False
End If

Call Chart_AreaFormat(objChart, _
gsDEF_FONTNAME, _
sngfontsize, _
giDEF_FONTCOLOUR_PALETTE, _
gsDEF_FONTBACKGROUND, _
gbDEF_FONTBOLD, _
, , , , , , , , , giDEF_PALETTEWHITE)

Call Chart_PlotAreaFormat(objChart, _
, , , giDEF_PALETTEWHITE)

Call Chart_LegendFormat(objChart, _
gsDEF_FONTNAME, _
sngfontsize, _
giDEF_FONTCOLOUR_PALETTE, _
gsDEF_FONTBACKGROUND, _
, , , , , , , , , , giDEF_PALETTEWHITE)

Call Chart_PlotAreaSizeMove(objChart, _
objChartArea.Width, 1, _
objChartArea.Height, 1)

Call Chart_TitleSizePosition(objChart, , sngfontsize)
Call Chart_LegendSizePosition(objChart, , sngfontsize)

If Chart_AxesExists(objChart, "P", "C") = True Then
Call Chart_AxesTitleSizePosition(objChart, "P", "C")
Call Chart_AxesFormat(objChart, "P", "C")
Call Chart_AxesXOptions(objChart, "P", "C")
End If

If Chart_AxesExists(objChart, "P", "V") = True Then
Call Chart_AxesTitleSizePosition(objChart, "P", "V")
Call Chart_AxesFormat(objChart, "P", "V")
Call Chart_AxesXOptions(objChart, "P", "V")

Call Chart_AxesYScaleAdjustToRP(objChart, "P", "V", False, True)

End If

If Chart_AxesExists(objChart, "S", "C") = True Then
Call Chart_AxesTitleSizePosition(objChart, "S", "C")
Call Chart_AxesFormat(objChart, "S", "C")
Call Chart_AxesXOptions(objChart, "S", "C")
End If
If Chart_AxesExists(objChart, "S", "V") = True Then
Call Chart_AxesTitleSizePosition(objChart, "S", "V")
Call Chart_AxesFormat(objChart, "S", "V")
Call Chart_AxesXOptions(objChart, "S", "V")

Call Chart_AxesYScaleAdjustToRP(objChart, "S", "V", False, True)
End If

For iseriescount = 1 To objSeriesCol.Count

If clszLateBindingExcel.ChartSeriesValid(objSeriesCol, _
iseriescount) = True Then

objSeries = objSeriesCol.Item(iseriescount)

Call ChartType_SeriesFormatLineOrArea(objChart, objSeries, iseriescount)

Call ChartType_SeriesFormat(objChart, "", objSeries, iseriescount)
End If

Next iseriescount


'purely for testing !!! to stop flickering with Chart Sheets
gbUPDATE_SCREEN = True

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
If gbUPDATE_SCREEN = False Then gApplication.ScreenUpdating = True

objChart = Nothing
objChartArea = Nothing
objSeriesCol = Nothing
objSeries = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("Chart_Format", msMODULENAME, _
"format the chart completely.", _
gobjCOMException, gobjException)
End If
End Try
End Sub

Chart_HeightReturn

public string Chart_HeightReturn()
{
Excel.Worksheet objWorksheet;
Excel.Chart objChart;
Excel.ChartObject objChartObject;

try
{
if (clsError.ErrorFlag() == true)
return;

if (Chart_InOne() == false)
{
Chart_HeightReturn = "Nothing";
return;
}

objChart = gApplication.ActiveChart;
objWorksheet = (Excel.Worksheet)gApplication.ActiveSheet;

objChartObject = (Excel.ChartObject)objChart.Parent;

Chart_HeightReturn = System.Convert.ToHexString(objChartObject.Height);
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objWorksheet = null/* TODO Change to default(_) if this is not a reference type */;
objChart = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("Chart_HeightReturn", msMODULENAME, "return the height of the active chart", gobjCOMException, gobjException);
}
}
Public Function Chart_HeightReturn() As String

Dim objWorksheet As Excel.Worksheet
Dim objChart As Excel.Chart
Dim objChartObject As Excel.ChartObject

Try
If clsError.ErrorFlag() = True Then Exit Function

If Chart_InOne() = False Then
Chart_HeightReturn = "Nothing"
Exit Function
End If

objChart = gApplication.ActiveChart
objWorksheet = CType(gApplication.ActiveSheet, Excel.Worksheet)

objChartObject = CType(objChart.Parent, Excel.ChartObject)

Chart_HeightReturn = CType(objChartObject.Height, String)

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objWorksheet = Nothing
objChart = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("Chart_HeightReturn", msMODULENAME, _
"return the height of the active chart", _
gobjCOMException, gobjException)
End If
End Try
End Function

Chart_InOne

Returns a boolean indicating if the current selection is inside a chart.
public bool Chart_InOne(bool bInformUser = false)
{
try
{
if (clsError.ErrorFlag() == true)
return;

if (Chart_ObjectValid(TypeName(gApplication.Selection)) == true)
Chart_InOne = true;
else
Chart_InOne = false;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
// If bInformUser = True Then
// INCLUDE a message !!

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("Chart_InOne", msMODULENAME, "determine if you are in a chart.", gobjCOMException, gobjException);
}
}
Returns a boolean indicating if the current selection is inside a chart.
Public Function Chart_InOne(Optional ByVal bInformUser As Boolean = False) _
As Boolean

Try
If clsError.ErrorFlag() = True Then Exit Function

If Chart_ObjectValid(TypeName(gApplication.Selection)) = True Then
Chart_InOne = True
Else
Chart_InOne = False
End If

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
'If bInformUser = True Then
'INCLUDE a message !!

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("Chart_InOne", msMODULENAME, _
"determine if you are in a chart.", _
gobjCOMException, gobjException)
End If
End Try
End Function

Chart_LocationGet

public static string LocationGet(Excel.Chart objChart)
{
try
{
if (clsError.ErrorFlag() == true)
return;

switch (TypeName(objChart.Parent))
{
case "Workbook":
case "WorkbookClass":
{
LocationGet = "Chart Sheet";
break;
}

case "ChartObject":
{
LocationGet = "Embedded Chart";
break;
}

default:
{
MsgBox("TypeName(objChart.Parent) = " + TypeName(objChart.Parent));
break;
}
}
}
catch (Runtime.InteropServices.COMException objCOMException)
{
mobjCOMException = objCOMException;
}
catch (Exception objException)
{
mobjException = objException;
}

finally
{
if (gbDEBUG_EXCEL == true | ((IsNothing(mobjCOMException) == false | IsNothing(mobjException) == false)))
clsError.Handle("LocationGet", "clsChart", "return the location of the active chart, whether chart sheet or embedded.", mobjCOMException, mobjException);
}
}
Public Shared Function LocationGet(ByVal objChart As Excel.Chart) As String

Try
If clsError.ErrorFlag() = True Then Exit Function

Select Case TypeName(objChart.Parent)

Case "Workbook", "WorkbookClass"
LocationGet = "Chart Sheet"

Case "ChartObject"
LocationGet = "Embedded Chart"

Case Else
Call MsgBox("TypeName(objChart.Parent) = " & TypeName(objChart.Parent))
End Select

Catch objCOMException As System.Runtime.InteropServices.COMException
mobjCOMException = objCOMException
Catch objException As Exception
mobjException = objException

Finally
If gbDEBUG_EXCEL = True Or _
((IsNothing(mobjCOMException) = False Or IsNothing(mobjException) = False)) Then

Call clsError.Handle("LocationGet", "clsChart", _
"return the location of the active chart, whether chart sheet or embedded.", _
mobjCOMException, mobjException)
End If
End Try

End Function

Chart_Move

public void Chart_Move(string sPlaceCol, int iPlaceRow, string sChartName = "", string sWshName = "")
{
try
{
if (clsError.ErrorFlag() == true)
return;

float sngfromleft;
float sngfromright;

// ActiveWorkbook.Styles("Normal").Font.Name = "Arial"
// ActiveWorkbook.Styles("Normal").Font.Size = 10

sngfromleft = clsCol.WidthToPoints("A", sPlaceCol);
sngfromright = clsRow.HeightToPoints(1, iPlaceRow);

Chart_MoveTopLeft(sngfromleft, sngfromright, sPlaceCol + iPlaceRow, sChartName);
}

// ActiveWorkbook.Styles("Normal").Font.Name = "Arial"
// ActiveWorkbook.Styles("Normal").Font.Size = 10
// Selection.Style = "Normal"

catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("Chart_Move", msMODULENAME, "move the chart a small distance ??", gobjCOMException, gobjException);
}
}
Public Sub Chart_Move(ByVal sPlaceCol As String, _
ByVal iPlaceRow As Integer, _
Optional ByVal sChartName As String = "", _
Optional ByVal sWshName As String = "")

Try
If clsError.ErrorFlag() = True Then Exit Sub

Dim sngfromleft As Single
Dim sngfromright As Single

' ActiveWorkbook.Styles("Normal").Font.Name = "Arial"
' ActiveWorkbook.Styles("Normal").Font.Size = 10

sngfromleft = clsCol.WidthToPoints("A", sPlaceCol)
sngfromright = clsRow.HeightToPoints(1, iPlaceRow)

Call Chart_MoveTopLeft(sngfromleft, sngfromright, _
sPlaceCol & iPlaceRow, sChartName)

' ActiveWorkbook.Styles("Normal").Font.Name = "Arial"
' ActiveWorkbook.Styles("Normal").Font.Size = 10
' Selection.Style = "Normal"

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("Chart_Move", msMODULENAME, _
"move the chart a small distance ??", _
gobjCOMException, gobjException)
End If
End Try
End Sub

Chart_MoveTopLeft

public void Chart_MoveTopLeft(float sngFromLeft, float sngFromTop, string sReturnCell = "", string sChartName = "", string sWshName = "")
{
Excel.Worksheet objWorksheet;
Excel.Range objRange;
Excel.ChartObject objChartObject;

try
{
if (clsError.ErrorFlag() == true)
return;

if (sWshName != "")
{
objWorksheet = (Excel.Worksheet)gApplication.Sheets(sWshName);
objWorksheet.Select();
}
if (sChartName == "")
sChartName = Chart_NameReturn();

objRange = objWorksheet.Range("A1");
objRange.Select();

objChartObject = (Excel.ChartObject)objWorksheet.ChartObjects(sChartName);

objChartObject.Left = sngFromLeft;
objChartObject.Top = sngFromTop;

if (sReturnCell != "")
{
objRange = objWorksheet.Range(sReturnCell);
objRange.Select(); // deactivates the chart
}
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objWorksheet = null/* TODO Change to default(_) if this is not a reference type */;
objRange = null/* TODO Change to default(_) if this is not a reference type */;
objChartObject = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("Chart_MoveTopLeft", msMODULENAME, "move the chart '" + sChartName + "'" + Constants.vbCrLf + sngFromLeft + " from the left" + Constants.vbCrLf + sngFromTop + " from the top" + Constants.vbCrLf + "relative to the worksheet.", gobjCOMException, gobjException);
}
}
Public Sub Chart_MoveTopLeft(ByVal sngFromLeft As Single, _
ByVal sngFromTop As Single, _
Optional ByVal sReturnCell As String = "", _
Optional ByVal sChartName As String = "", _
Optional ByVal sWshName As String = "")

Dim objWorksheet As Excel.Worksheet
Dim objRange As Excel.Range
Dim objChartObject As Excel.ChartObject

Try
If clsError.ErrorFlag() = True Then Exit Sub

If sWshName <> "" Then
objWorksheet = CType(gApplication.Sheets(sWshName), Excel.Worksheet)
objWorksheet.Select()
End If
If sChartName = "" Then sChartName = Chart_NameReturn()

objRange = objWorksheet.Range("A1")
objRange.Select()

objChartObject = CType(objWorksheet.ChartObjects(sChartName), Excel.ChartObject)

objChartObject.Left = sngFromLeft
objChartObject.Top = sngFromTop

If sReturnCell <> "" Then
objRange = objWorksheet.Range(sReturnCell)
objRange.Select() 'deactivates the chart
End If

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objWorksheet = Nothing
objRange = Nothing
objChartObject = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("Chart_MoveTopLeft", msMODULENAME, _
"move the chart '" & sChartName & "'" & vbCrLf & _
sngFromLeft & " from the left" & vbCrLf & _
sngFromTop & " from the top" & vbCrLf & _
"relative to the worksheet.", _
gobjCOMException, gobjException)
End If
End Try
End Sub

Chart_NameGet

public string Chart_NameGet(string sChartName = "")
{
Excel.Worksheet objWorksheet;
Excel.Chart objChart;

try
{
if (clsError.ErrorFlag() == true)
return;

if (Chart_InOne() == false)
{
Chart_NameGet = "Nothing";
return;
}

if (sChartName.Length == 0)
{
objChart = gApplication.ActiveChart;
objWorksheet = (Excel.Worksheet)gApplication.ActiveSheet;

sChartName = objChart.Name;
Chart_NameGet = sChartName.Substring(Len(objWorksheet.Name) + 1);
}
else
Chart_NameGet = sChartName;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objWorksheet = null/* TODO Change to default(_) if this is not a reference type */;
objChart = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("Chart_NameReturn", msMODULENAME, "return the name of the active chart.", gobjCOMException, gobjException);
}
}
Public Function Chart_NameGet(Optional ByVal sChartName As String = "") _
As String

Dim objWorksheet As Excel.Worksheet
Dim objChart As Excel.Chart

Try
If clsError.ErrorFlag() = True Then Exit Function

If Chart_InOne() = False Then
Chart_NameGet = "Nothing"
Exit Function
End If

If sChartName.Length = 0 Then
objChart = gApplication.ActiveChart
objWorksheet = CType(gApplication.ActiveSheet, Excel.Worksheet)

sChartName = objChart.Name
Chart_NameGet = sChartName.Substring(Len(objWorksheet.Name) + 1)
Else
Chart_NameGet = sChartName
End If

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objWorksheet = Nothing
objChart = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("Chart_NameReturn", msMODULENAME, _
"return the name of the active chart.", _
gobjCOMException, gobjException)
End If
End Try
End Function

Chart_NameReturn

public string Chart_NameReturn(bool bSelectCell = false)
{
Excel.Worksheet objWorksheet;
Excel.Range objRange;
Excel.Chart objChart;

try
{
if (clsError.ErrorFlag() == true)
return;

string sChartName;

if (Chart_InOne() == false)
{
Chart_NameReturn = "Nothing";
return;
}

objChart = gApplication.ActiveChart;
objWorksheet = (Excel.Worksheet)gApplication.ActiveSheet;

sChartName = objChart.Name;
Chart_NameReturn = sChartName.Substring(Len(objWorksheet.Name) + 1);

if (bSelectCell == true)
{
objRange = objWorksheet.Range("A1");
objRange.Select();
}
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objWorksheet = null/* TODO Change to default(_) if this is not a reference type */;
objRange = null/* TODO Change to default(_) if this is not a reference type */;
objChart = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("Chart_NameReturn", msMODULENAME, "return the name of the active chart", gobjCOMException, gobjException);
}
}
Public Function Chart_NameReturn(Optional ByVal bSelectCell As Boolean = False) _
As String

Dim objWorksheet As Excel.Worksheet
Dim objRange As Excel.Range
Dim objChart As Excel.Chart

Try
If clsError.ErrorFlag() = True Then Exit Function

Dim sChartName As String

If Chart_InOne() = False Then
Chart_NameReturn = "Nothing"
Exit Function
End If

objChart = gApplication.ActiveChart
objWorksheet = CType(gApplication.ActiveSheet, Excel.Worksheet)

sChartName = objChart.Name
Chart_NameReturn = sChartName.Substring(Len(objWorksheet.Name) + 1)

If bSelectCell = True Then
objRange = objWorksheet.Range("A1")
objRange.Select()
End If

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objWorksheet = Nothing
objRange = Nothing
objChart = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("Chart_NameReturn", msMODULENAME, _
"return the name of the active chart", _
gobjCOMException, gobjException)
End If
End Try
End Function

Chart_ObjectValid

public bool Chart_ObjectValid(string sObjectName)
{
try
{
if (clsError.ErrorFlag() == true)
return;

switch (sObjectName + Strings.Space(12 - sObjectName.Length))
{
default:
{
// Call MsgBox(sObjectName & " - Chart_ObjectValid")
Chart_ObjectValid = false;
break;
}
}
}

catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("Chart_ObjectValid", msMODULENAME, "determine if the object '" + sObjectName + "' is a valid chart object.", gobjCOMException, gobjException);
}
}
Public Function Chart_ObjectValid(ByVal sObjectName As String) _
As Boolean

Try
If clsError.ErrorFlag() = True Then Exit Function

Select Case sObjectName & Space(12 - sObjectName.Length)

'copy from VBA

Case Else
'Call MsgBox(sObjectName & " - Chart_ObjectValid")
Chart_ObjectValid = False
End Select


Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("Chart_ObjectValid", msMODULENAME, _
"determine if the object '" & sObjectName & "' is a valid chart object.", _
gobjCOMException, gobjException)
End If
End Try
End Function

Chart_Size

public void Chart_Size(double dbWidth, double dbHeight, string sDeSelectCell = "", string sChartName = "", string sWshName = "")
{
Excel.Worksheet objWorksheet;
Excel.ChartObject objChartObject;
Excel.Range objRange;

try
{
if (clsError.ErrorFlag() == true)
return;

if (Strings.Len(sWshName) > 0)
{
objWorksheet = (Excel.Worksheet)gApplication.Worksheets(sWshName);
objWorksheet.Select();
}
else
objWorksheet = (Excel.Worksheet)gApplication.ActiveSheet;
if (Strings.Len(sChartName) == 0)
sChartName = Chart_NameReturn();

objChartObject = (Excel.ChartObject)objWorksheet.ChartObjects(sChartName);

objChartObject.Height = dbHeight;
objChartObject.Width = dbWidth;

objChartObject.Activate();

if (sDeSelectCell != "")
{
objRange = (Excel.Range)objWorksheet.Range(sDeSelectCell);
objRange.Select();
}
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objWorksheet = null/* TODO Change to default(_) if this is not a reference type */;
objChartObject = null/* TODO Change to default(_) if this is not a reference type */;
objRange = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("Chart_Size", msMODULENAME, "size the chart " + Chart_NameGet(sChartName), gobjCOMException, gobjException);
}
}
Public Sub Chart_Size(ByVal dbWidth As Double, _
ByVal dbHeight As Double, _
Optional ByVal sDeSelectCell As String = "", _
Optional ByVal sChartName As String = "", _
Optional ByVal sWshName As String = "")

Dim objWorksheet As Excel.Worksheet
Dim objChartObject As Excel.ChartObject
Dim objRange As Excel.Range

Try
If clsError.ErrorFlag() = True Then Exit Sub

If Len(sWshName) > 0 Then
objWorksheet = CType(gApplication.Worksheets(sWshName), Excel.Worksheet)
objWorksheet.Select()
Else
objWorksheet = CType(gApplication.ActiveSheet, Excel.Worksheet)
End If
If Len(sChartName) = 0 Then
sChartName = Chart_NameReturn()
End If

objChartObject = CType(objWorksheet.ChartObjects(sChartName), Excel.ChartObject)

objChartObject.Height = dbHeight
objChartObject.Width = dbWidth

objChartObject.Activate()

If sDeSelectCell <> "" Then
objRange = CType(objWorksheet.Range(sDeSelectCell), Excel.Range)
objRange.Select()
End If

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objWorksheet = Nothing
objChartObject = Nothing
objRange = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("Chart_Size", msMODULENAME, _
"size the chart " & Chart_NameGet(sChartName), _
gobjCOMException, gobjException)
End If
End Try
End Sub

Chart_SizeObj

public void Chart_SizeObj(Excel.Chart objChart, double dbWidth, double dbHeight)
{
Excel.ChartObject objChartObject;

try
{
if (clsError.ErrorFlag() == true)
return;

objChartObject = (Excel.ChartObject)objChart.Parent;

objChartObject.Height = dbHeight;
objChartObject.Width = dbWidth;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objChartObject = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("Chart_SizeObj", msMODULENAME, "change the chart object to the following size:" + Constants.vbCrLf + "Width: '" + dbWidth + "'" + Constants.vbCrLf + "Height: '" + dbHeight + "'", gobjCOMException, gobjException);
}
}
Public Sub Chart_SizeObj(ByVal objChart As Excel.Chart, _
ByVal dbWidth As Double, _
ByVal dbHeight As Double)

Dim objChartObject As Excel.ChartObject

Try
If clsError.ErrorFlag() = True Then Exit Sub

objChartObject = CType(objChart.Parent, Excel.ChartObject)

objChartObject.Height = dbHeight
objChartObject.Width = dbWidth

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objChartObject = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("Chart_SizeObj", msMODULENAME, _
"change the chart object to the following size:" & vbCrLf & _
"Width: '" & dbWidth & "'" & vbCrLf & _
"Height: '" & dbHeight & "'", _
gobjCOMException, gobjException)
End If
End Try
End Sub

Chart_WidthReturn

public string Chart_WidthReturn()
{
Excel.Worksheet objWorksheet;
Excel.Chart objChart;
Excel.ChartObject objChartObject;

try
{
if (clsError.ErrorFlag() == true)
return;

if (Chart_InOne() == false)
{
Chart_WidthReturn = "Nothing";
return;
}

objChart = gApplication.ActiveChart;
objWorksheet = (Excel.Worksheet)gApplication.ActiveSheet;

objChartObject = (Excel.ChartObject)objChart.Parent;

Chart_WidthReturn = System.Convert.ToHexString(objChartObject.Width);
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objWorksheet = null/* TODO Change to default(_) if this is not a reference type */;
objChart = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("Chart_WidthReturn", msMODULENAME, "return the width of the active chart", gobjCOMException, gobjException);
}
}
Public Function Chart_WidthReturn() As String

Dim objWorksheet As Excel.Worksheet
Dim objChart As Excel.Chart
Dim objChartObject As Excel.ChartObject

Try
If clsError.ErrorFlag() = True Then Exit Function

If Chart_InOne() = False Then
Chart_WidthReturn = "Nothing"
Exit Function
End If

objChart = gApplication.ActiveChart
objWorksheet = CType(gApplication.ActiveSheet, Excel.Worksheet)

objChartObject = CType(objChart.Parent, Excel.ChartObject)

Chart_WidthReturn = CType(objChartObject.Width, String)

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objWorksheet = Nothing
objChart = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("Chart_WidthReturn", msMODULENAME, _
"return the width of the active chart", _
gobjCOMException, gobjException)
End If
End Try
End Function

ChartAxis_Category_IsValueAxis

public bool ChartAxis_CategoryIsValueAxis(Excel.Axis objAxis)
{
XlScaleType enscaletype;
;/* Cannot convert OnErrorGoToStatementSyntax, CONVERSION ERROR: Conversion for OnErrorGoToLabelStatement not implemented, please report this issue in 'On Error GoTo AnError' at character 144
at ICSharpCode.CodeConverter.CSharp.VisualBasicConverter.MethodBodyVisitor.DefaultVisit(SyntaxNode node) in /home/runner/work/CodeConverter/CodeConverter/.temp/codeconverter/ICSharpCode.CodeConverter/CSharp/MethodBodyVisitor.cs:line 41
at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxVisitor`1.Visit(SyntaxNode node)
at ICSharpCode.CodeConverter.CSharp.CommentConvertingMethodBodyVisitor.DefaultVisit(SyntaxNode node) in /home/runner/work/CodeConverter/CodeConverter/.temp/codeconverter/ICSharpCode.CodeConverter/CSharp/CommentConvertingMethodBodyVisitor.cs:line 27

Input:

On Error GoTo AnError

*/
enscaletype = objAxis.ScaleType;
Axis_CategoryIsValueAxis = true;

AnError:
;
Axis_CategoryIsValueAxis = false;
}
Public Function ChartAxis_CategoryIsValueAxis(ByVal objAxis As Excel.Axis) As Boolean
Dim enscaletype As XlScaleType

On Error GoTo AnError

enscaletype = objAxis.ScaleType
Axis_CategoryIsValueAxis = True

AnError:
Axis_CategoryIsValueAxis = False
End Function

ChartAxis_Exists

public bool ChartAxis_Exists(Excel.Chart objChart, string sAxisGroup, string sAxisType, bool bInformUser = false)
{
try
{
if (clsError.ErrorFlag() == true)
return;

if (ChartType_SeriesTypeIsItPie((Excel.Series)objChart.SeriesCollection(1)) == true | ChartType_SeriesTypeIsItDoughnut((Excel.Series)objChart.SeriesCollection(1)) == true | ChartType_SeriesTypeIsItSurface((Excel.Series)objChart.SeriesCollection(1)) == true | ChartType_SeriesTypeIsIt3D((Excel.Series)objChart.SeriesCollection(1)))
ChartAxis_Exists = false;
else
ChartAxis_Exists = System.Convert.ToBoolean(objChart.HasAxis(zReturn_AxisType(sAxisType), zReturn_AxisGroup(sAxisGroup)));
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
if (bInformUser == true)
App_MessageChartTypeDoesNotExist(sAxisGroup, sAxisType);

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartAxis_Exists", msMODULENAME, "determine if the chart axes: " + "Axis Group - " + sAxisGroup + " Axis Type - " + sAxisType + " exists.", gobjCOMException, gobjException);
}
}
Public Function ChartAxis_Exists(ByVal objChart As Excel.Chart, _
ByVal sAxisGroup As String, _
ByVal sAxisType As String, _
Optional ByVal bInformUser As Boolean = False) _
As Boolean

Try
If clsError.ErrorFlag() = True Then Exit Function

If ChartType_SeriesTypeIsItPie(CType(objChart.SeriesCollection(1), _
Excel.Series)) = True Or _
ChartType_SeriesTypeIsItDoughnut(CType(objChart.SeriesCollection(1), _
Excel.Series)) = True Or _
ChartType_SeriesTypeIsItSurface(CType(objChart.SeriesCollection(1), _
Excel.Series)) = True Or _
ChartType_SeriesTypeIsIt3D(CType(objChart.SeriesCollection(1), _
Excel.Series)) Then

ChartAxis_Exists = False
Else

ChartAxis_Exists = CBool(objChart.HasAxis(zReturn_AxisType(sAxisType), _
zReturn_AxisGroup(sAxisGroup)))
End If

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
If bInformUser = True Then
Call App_MessageChartTypeDoesNotExist(sAxisGroup, sAxisType)
End If

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartAxis_Exists", msMODULENAME, _
"determine if the chart axes: " & _
"Axis Group - " & sAxisGroup & " Axis Type - " & sAxisType & " exists.", _
gobjCOMException, gobjException)
End If
End Try
End Function

ChartAxis_Format

public void ChartAxis_Format(Excel.Chart objChart, string sAxisGroup, string sAxisType, int iAxisColourIdx = giDEF_PALETTEAXESCOLOUR)
{
Excel.Axis objAxis;

try
{
if (clsError.ErrorFlag() == true)
return;

objAxis = (Excel.Axis)objChart.Axes(zReturn_AxisType(sAxisType), zReturn_AxisGroup(sAxisGroup));

{
var withBlock = objAxis;
// .Border.Color =
withBlock.Border.ColorIndex = iAxisColourIdx;
withBlock.Border.Weight = Excel.XlBorderWeight.xlHairline;
withBlock.Border.LineStyle = Excel.XlLineStyle.xlContinuous;

if (withBlock.HasMajorGridlines == true)
{
withBlock.MajorGridlines.Border.ColorIndex = iAxisColourIdx;
withBlock.MajorTickMark = Excel.XlTickMark.xlTickMarkOutside;
}
if (withBlock.HasMinorGridlines == true)
{
withBlock.MinorGridlines.Border.ColorIndex = iAxisColourIdx;
withBlock.MinorTickMark = Excel.XlTickMark.xlTickMarkNone;
}

withBlock.TickLabelPosition = Excel.XlTickLabelPosition.xlTickLabelPositionNextToAxis;

withBlock.TickLabels.Orientation = Excel.XlTickLabelOrientation.xlTickLabelOrientationHorizontal;
}
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objAxis = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartAxis_Format", msMODULENAME, "format the chart axis " + "AxisGroup - " + sAxisGroup + " AxisType - " + sAxisType + " axis.", gobjCOMException, gobjException);
}
}
Public Sub ChartAxis_Format(ByVal objChart As Excel.Chart, _
ByVal sAxisGroup As String, _
ByVal sAxisType As String, _
Optional ByVal iAxisColourIdx As Integer = giDEF_PALETTEAXESCOLOUR)

Dim objAxis As Excel.Axis

Try
If clsError.ErrorFlag() = True Then Exit Sub

objAxis = CType(objChart.Axes(zReturn_AxisType(sAxisType), _
zReturn_AxisGroup(sAxisGroup)), Excel.Axis)

With objAxis
'.Border.Color =
.Border.ColorIndex = iAxisColourIdx
.Border.Weight = Excel.XlBorderWeight.xlHairline
.Border.LineStyle = Excel.XlLineStyle.xlContinuous

If .HasMajorGridlines = True Then
.MajorGridlines.Border.ColorIndex = iAxisColourIdx
.MajorTickMark = Excel.XlTickMark.xlTickMarkOutside
End If
If .HasMinorGridlines = True Then
.MinorGridlines.Border.ColorIndex = iAxisColourIdx
.MinorTickMark = Excel.XlTickMark.xlTickMarkNone
End If

.TickLabelPosition = Excel.XlTickLabelPosition.xlTickLabelPositionNextToAxis

.TickLabels.Orientation = _
Excel.XlTickLabelOrientation.xlTickLabelOrientationHorizontal
End With

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objAxis = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartAxis_Format", msMODULENAME, _
"format the chart axis " & _
"AxisGroup - " & sAxisGroup & " AxisType - " & sAxisType & " axis.", _
gobjCOMException, gobjException)
End If
End Try
End Sub

ChartAxis_ScaleAdjustmentLargest

public float ChartAxis_ScaleAdjustmentLargest(float sngSmallest, float sngLargest, float sngAccuracy = 0.01)
{
try
{
if (clsError.ErrorFlag() == true)
return;

float sngdifference;

// calculate the actual difference
sngdifference = Math.Abs(sngLargest - sngSmallest);

if ((sngSmallest != 0) & (sngdifference < sngSmallest))
{
if (sngLargest < 0)
sngLargest = sngLargest - (sngdifference * sngAccuracy);
if (sngLargest > 0)
sngLargest = sngLargest + (sngdifference * sngAccuracy);
}

if ((sngSmallest != 0) & (sngSmallest < sngdifference))
{
// I DONT THINK WE NEED BOTH OF THESE !!
if (sngLargest < 0)
sngLargest = sngLargest + (sngLargest * sngAccuracy);
if (sngLargest > 0)
sngLargest = sngLargest + (sngLargest * sngAccuracy);
}
ChartAxis_LargestAdjustment = sngLargest;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartAxis_LargestAdjustment", msMODULENAME, "return the adjusted number for the largest value on an axis.", gobjCOMException, gobjException);
}
}
Public Function ChartAxis_ScaleAdjustmentLargest(ByVal sngSmallest As Single, _
ByVal sngLargest As Single, _
Optional ByVal sngAccuracy As Single = 0.01) _
As Single

Try
If clsError.ErrorFlag() = True Then Exit Function

Dim sngdifference As Single

'calculate the actual difference
sngdifference = Math.Abs(sngLargest - sngSmallest)

If (sngSmallest <> 0) And (sngdifference < sngSmallest) Then
If sngLargest < 0 Then sngLargest = sngLargest - (sngdifference * sngAccuracy)
If sngLargest > 0 Then sngLargest = sngLargest + (sngdifference * sngAccuracy)
End If

If (sngSmallest <> 0) And (sngSmallest < sngdifference) Then
' I DONT THINK WE NEED BOTH OF THESE !!
If sngLargest < 0 Then sngLargest = sngLargest + (sngLargest * sngAccuracy)
If sngLargest > 0 Then sngLargest = sngLargest + (sngLargest * sngAccuracy)
End If
ChartAxis_LargestAdjustment = sngLargest

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartAxis_LargestAdjustment", msMODULENAME, _
"return the adjusted number for the largest value on an axis.", _
gobjCOMException, gobjException)
End If
End Try
End Function

ChartAxis_ScaleAdjustmentSmallest

public float ChartAxis_ScaleAdjustmentSmallest(float sngSmallest, float sngLargest, float sngAccuracy = 0.01)
{
try
{
if (clsError.ErrorFlag() == true)
return;

float sngdifference;

// calculate the actual difference
sngdifference = Math.Abs(sngLargest - sngSmallest);

if ((sngSmallest != 0) & (sngdifference < sngSmallest))
{
if (sngSmallest < 0)
sngSmallest = sngSmallest + (sngdifference * sngAccuracy);
if (sngSmallest > 0)
sngSmallest = sngSmallest - (sngdifference * sngAccuracy);
}

if ((sngSmallest != 0) & (sngSmallest < sngdifference))
{
if (sngSmallest < 0)
sngSmallest = sngSmallest + (sngSmallest * sngAccuracy);
if (sngSmallest > 0)
sngSmallest = sngSmallest - (sngSmallest * sngAccuracy);
}
ChartAxis_SmallestAdjustment = sngSmallest;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartAxis_SmallestAdjustment", msMODULENAME, "return the adjusted number for the smallest value on an axis.", gobjCOMException, gobjException);
}
}
Public Function ChartAxis_ScaleAdjustmentSmallest(ByVal sngSmallest As Single, _
ByVal sngLargest As Single, _
Optional ByVal sngAccuracy As Single = 0.01) _
As Single

Try
If clsError.ErrorFlag() = True Then Exit Function

Dim sngdifference As Single

'calculate the actual difference
sngdifference = Math.Abs(sngLargest - sngSmallest)

If (sngSmallest <> 0) And (sngdifference < sngSmallest) Then
If sngSmallest < 0 Then
sngSmallest = sngSmallest + (sngdifference * sngAccuracy)
End If
If sngSmallest > 0 Then
sngSmallest = sngSmallest - (sngdifference * sngAccuracy)
End If
End If

If (sngSmallest <> 0) And (sngSmallest < sngdifference) Then
If sngSmallest < 0 Then
sngSmallest = sngSmallest + (sngSmallest * sngAccuracy)
End If
If sngSmallest > 0 Then
sngSmallest = sngSmallest - (sngSmallest * sngAccuracy)
End If
End If
ChartAxis_SmallestAdjustment = sngSmallest

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartAxis_SmallestAdjustment", msMODULENAME, _
"return the adjusted number for the smallest value on an axis.", _
gobjCOMException, gobjException)
End If
End Try
End Function

ChartAxis_TitleSizePosition

public void ChartAxis_TitleSizePosition(Excel.Chart objChart, string sAxisGroup = "P", string sAxisType = "V", bool bBold = false)
{
Excel.Window objWindow;
Excel.Worksheet objWorksheet;
Excel.ChartObject objChartObject;
Excel.Axis objAxis;
Excel.Range objRange;

try
{
if (clsError.ErrorFlag() == true)
return;

int ibeforewindowpercent;
string scurrentname;

// scurrentname = Chart_NameReturn(True)
// 'gApplication.ScreenUpdating = False

// objWindow = CType(gApplication.ActiveWindow, Excel.Window)

// ibeforewindowpercent = CInt(objWindow.Zoom)

// objWindow.Zoom = 50 'reduce screen to position title - CHECK WE NEED !!

// objWsh = CType(gApplication.ActiveSheet, Excel.Worksheet)
// objChartObject = CType(objWsh.ChartObjects(scurrentname), Excel.ChartObject)

// objChartObject.Activate()

// objChart = objChartObject.Chart


// objChart = CType(gApplication.ActiveChart, Excel.Chart)

objAxis = (Excel.Axis)objChart.Axes(zReturn_AxisType(sAxisType), zReturn_AxisGroup(sAxisGroup));

{
var withBlock = objChart;
if (objAxis.HasTitle == true)
{
if (bBold == true)
objAxis.AxisTitle.Font.Bold = bBold;
// ---------------------
if (sAxisGroup == "P" & sAxisType == "C")
{
withBlock.PlotArea.Top = 1;
withBlock.PlotArea.Height = withBlock.ChartArea.Height;
withBlock.PlotArea.Height = withBlock.PlotArea.Height - giDEF_AXISTITLESPACE;

// Selection.AxisTitle.Left = needs to be centered !!!!

objAxis.AxisTitle.Top = withBlock.ChartArea.Height - giDEF_AXISTITLESPACE;
objAxis.AxisTitle.Orientation = 0; // title is horizontal
}
// ---------------------
if (sAxisGroup == "P" & sAxisType == "V")
{
withBlock.PlotArea.Width = withBlock.ChartArea.Width;
withBlock.PlotArea.Width = withBlock.PlotArea.Width - giDEF_AXISTITLESPACE - 4;

withBlock.PlotArea.Left = 1;
withBlock.PlotArea.Left = withBlock.PlotArea.Left + giDEF_AXISTITLESPACE;

objAxis.AxisTitle.Top = withBlock.PlotArea.Height;
objAxis.AxisTitle.Top = Int(objAxis.AxisTitle.Top / (double)2) - giDEF_XAXESSPACE;
objAxis.AxisTitle.Left = 1;
objAxis.AxisTitle.Orientation = 90; // title is 90 degrees
}
// ---------------------
if (sAxisGroup == "S" & sAxisType == "C")
{
withBlock.PlotArea.Height = withBlock.ChartArea.Height - (2 * giDEF_AXISTITLESPACE);
withBlock.PlotArea.Top = withBlock.PlotArea.Top + giDEF_AXISTITLESPACE;

// Selection.AxisTitle.Left = needs to be centered !!!!

objAxis.AxisTitle.Top = 1;
objAxis.AxisTitle.Orientation = 0; // title is horizontal
}
// ---------------------
if (sAxisGroup == "S" & sAxisType == "V")
{
withBlock.PlotArea.Width = withBlock.ChartArea.Width;
withBlock.PlotArea.Width = withBlock.PlotArea.Width - giDEF_AXISTITLESPACE;
// plotarea.left == as the width is reduced should move left automatically

objAxis.AxisTitle.Top = withBlock.PlotArea.Height;
objAxis.AxisTitle.Top = Int(objAxis.AxisTitle.Top / (double)2) - giDEF_XAXESSPACE;
objAxis.AxisTitle.Left = withBlock.ChartArea.Width - giDEF_AXISTITLESPACE + 2;
objAxis.AxisTitle.Orientation = -90; // title is vertical reading right
}
}
}
}

// objRange = CType(objWsh.Range("A1"), Excel.Range)
// objRange.Select()

// objWindow.Zoom = ibeforewindowpercent 'return the zoom percentage

// objChartObject.Activate()

// gApplication.ScreenUpdating = True

catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objChart = null/* TODO Change to default(_) if this is not a reference type */;
objWindow = null/* TODO Change to default(_) if this is not a reference type */;
objWorksheet = null/* TODO Change to default(_) if this is not a reference type */;
objChartObject = null/* TODO Change to default(_) if this is not a reference type */;
objAxis = null/* TODO Change to default(_) if this is not a reference type */;
objRange = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartAxis_TitleSizePosition", msMODULENAME, "size and position the axis title for the chart axis " + "AxisGroup - " + sAxisGroup + " AxisType - " + sAxisType + " axis.", gobjCOMException, gobjException);
}
}
Public Sub ChartAxis_TitleSizePosition(ByVal objChart As Excel.Chart, _
Optional ByVal sAxisGroup As String = "P", _
Optional ByVal sAxisType As String = "V", _
Optional ByVal bBold As Boolean = False)

Dim objWindow As Excel.Window
Dim objWorksheet As Excel.Worksheet
Dim objChartObject As Excel.ChartObject
Dim objAxis As Excel.Axis
Dim objRange As Excel.Range

Try
If clsError.ErrorFlag() = True Then Exit Sub

Dim ibeforewindowpercent As Integer
Dim scurrentname As String

'scurrentname = Chart_NameReturn(True)
''gApplication.ScreenUpdating = False

'objWindow = CType(gApplication.ActiveWindow, Excel.Window)

'ibeforewindowpercent = CInt(objWindow.Zoom)

'objWindow.Zoom = 50 'reduce screen to position title - CHECK WE NEED !!

'objWsh = CType(gApplication.ActiveSheet, Excel.Worksheet)
'objChartObject = CType(objWsh.ChartObjects(scurrentname), Excel.ChartObject)

'objChartObject.Activate()

'objChart = objChartObject.Chart


'objChart = CType(gApplication.ActiveChart, Excel.Chart)

objAxis = CType(objChart.Axes(zReturn_AxisType(sAxisType), _
zReturn_AxisGroup(sAxisGroup)), Excel.Axis)

With objChart
If objAxis.HasTitle = True Then
If bBold = True Then objAxis.AxisTitle.Font.Bold = bBold
'---------------------
If sAxisGroup = "P" And sAxisType = "C" Then
.PlotArea.Top = 1
.PlotArea.Height = .ChartArea.Height
.PlotArea.Height = .PlotArea.Height - giDEF_AXISTITLESPACE

'Selection.AxisTitle.Left = needs to be centered !!!!

objAxis.AxisTitle.Top = .ChartArea.Height - giDEF_AXISTITLESPACE
objAxis.AxisTitle.Orientation = 0 'title is horizontal
End If
'---------------------
If sAxisGroup = "P" And sAxisType = "V" Then
.PlotArea.Width = .ChartArea.Width
.PlotArea.Width = .PlotArea.Width - giDEF_AXISTITLESPACE - 4

.PlotArea.Left = 1
.PlotArea.Left = .PlotArea.Left + giDEF_AXISTITLESPACE

objAxis.AxisTitle.Top = .PlotArea.Height
objAxis.AxisTitle.Top = Int(objAxis.AxisTitle.Top / 2) - giDEF_XAXESSPACE
objAxis.AxisTitle.Left = 1
objAxis.AxisTitle.Orientation = 90 'title is 90 degrees
End If
'---------------------
If sAxisGroup = "S" And sAxisType = "C" Then
.PlotArea.Height = .ChartArea.Height - (2 * giDEF_AXISTITLESPACE)
.PlotArea.Top = .PlotArea.Top + giDEF_AXISTITLESPACE

'Selection.AxisTitle.Left = needs to be centered !!!!

objAxis.AxisTitle.Top = 1
objAxis.AxisTitle.Orientation = 0 'title is horizontal
End If
'---------------------
If sAxisGroup = "S" And sAxisType = "V" Then

.PlotArea.Width = .ChartArea.Width
.PlotArea.Width = .PlotArea.Width - giDEF_AXISTITLESPACE
'plotarea.left == as the width is reduced should move left automatically

objAxis.AxisTitle.Top = .PlotArea.Height
objAxis.AxisTitle.Top = Int(objAxis.AxisTitle.Top / 2) - giDEF_XAXESSPACE
objAxis.AxisTitle.Left = .ChartArea.Width - giDEF_AXISTITLESPACE + 2
objAxis.AxisTitle.Orientation = -90 'title is vertical reading right
End If
'---------------------
End If
End With

'objRange = CType(objWsh.Range("A1"), Excel.Range)
'objRange.Select()

'objWindow.Zoom = ibeforewindowpercent 'return the zoom percentage

'objChartObject.Activate()

'gApplication.ScreenUpdating = True

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objChart = Nothing
objWindow = Nothing
objWorksheet = Nothing
objChartObject = Nothing
objAxis = Nothing
objRange = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartAxis_TitleSizePosition", msMODULENAME, _
"size and position the axis title for the chart axis " & _
"AxisGroup - " & sAxisGroup & " AxisType - " & sAxisType & " axis.", _
gobjCOMException, gobjException)
End If
End Try
End Sub

ChartAxis_XCalculateNoOfLabels

public double ChartAxis_XCalculateNoOfLabels(double dbDaysDifference)
{
try
{
if (clsError.ErrorFlag() == true)
return;

int icount;
int ismallestlabelno;
int ismallestremainder;

ismallestlabelno = 5;
ismallestremainder = System.Convert.ToInt32(dbDaysDifference % ismallestlabelno);
for (icount = 5; icount >= 3; icount += -1)
{
if (dbDaysDifference % icount == 0)
{
ismallestremainder = System.Convert.ToInt32(dbDaysDifference % icount);
ismallestlabelno = icount;
break;
}
else if (dbDaysDifference % icount < ismallestremainder)
{
ismallestremainder = System.Convert.ToInt32(dbDaysDifference % icount);
ismallestlabelno = icount;
}
}

ChartAxis_XCalculateNoOfLabels = Math.Ceiling(dbDaysDifference / ismallestlabelno);
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartAxis_XCalculateNoOfLabels", msMODULENAME, "return the number of labels required for the X-axis.", gobjCOMException, gobjException);
}
}
Public Function ChartAxis_XCalculateNoOfLabels(ByVal dbDaysDifference As Double) _
As Double

Try
If clsError.ErrorFlag() = True Then Exit Function

Dim icount As Integer
Dim ismallestlabelno As Integer
Dim ismallestremainder As Integer

ismallestlabelno = 5
ismallestremainder = CInt(dbDaysDifference Mod ismallestlabelno)
For icount = 5 To 3 Step -1
If dbDaysDifference Mod icount = 0 Then
ismallestremainder = CInt(dbDaysDifference Mod icount)
ismallestlabelno = icount
Exit For
Else
If dbDaysDifference Mod icount < ismallestremainder Then
ismallestremainder = CInt(dbDaysDifference Mod icount)
ismallestlabelno = icount
End If
End If
Next icount

ChartAxis_XCalculateNoOfLabels = Math.Ceiling(dbDaysDifference / ismallestlabelno)

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartAxis_XCalculateNoOfLabels", msMODULENAME, _
"return the number of labels required for the X-axis.", _
gobjCOMException, gobjException)
End If
End Try
End Function

ChartAxis_XOptions

public void ChartAxis_XOptions(Excel.Chart objChart, string sAxisGroup = "P", string sAxisType = "V", string sAxisCategory = "AS", bool bAxisShowIt = true, string sAxisBaseUnit = "D", string sAxisMajorUnit = "M", string sAxisMinorUnit = "M", string sMajorTickMarkPos = "OU", string sMinorTickMarkPos = "OU", string sTickLabelPos = "NA", bool bMinorGridlines = false, bool bMajorGridlines = false, string sTickLabelFormat = "", string sTickLabelsOrientation = "AU", int iTickLabelSpacing = 1, int iTickMarkSpacing = 1, bool bAxisBetweenCategories = true, int iAxisCrossesAt = 0)
{
object objSelection;
Excel.Axis objAxis;

try
{
if (clsError.ErrorFlag() == true)
return;

double dbnoofdaysdifference;
int iminimumdate;
int imaximumdate; // declares for dates

objAxis = (Excel.Axis)objChart.Axes(zReturn_AxisType(sAxisType), zReturn_AxisGroup(sAxisGroup));

// this automatically selects the whole chart area
objSelection = gApplication.Selection;

objChart.HasAxis(zReturn_AxisType(sAxisType), zReturn_AxisGroup(sAxisGroup)) = true;

// Throw New System.Exception("testing")

{
var withBlock = objAxis;
if (sAxisType == "C")
{
if ((withBlock.CategoryType == Excel.XlCategoryType.xlAutomaticScale))
withBlock.CategoryType = zReturn_AxisCategoryType(sAxisCategory);

if ((withBlock.CategoryType == Excel.XlCategoryType.xlTimeScale) | (sAxisCategory == "TS"))
withBlock.BaseUnit = zReturn_TimeSeriesUnit(sAxisBaseUnit);
}

withBlock.MinorTickMark = zReturn_TickMarkPosition(sMinorTickMarkPos);
withBlock.MajorTickMark = zReturn_TickMarkPosition(sMajorTickMarkPos);

// check that if the chart has gridlines they are deleted ????

withBlock.TickLabelPosition = zReturn_TickLabelPosition(sTickLabelPos);

// gridlines only for primary axes except 3D charts ??

// either primary axes either primary or secondary
if (sAxisGroup == "P")
{
withBlock.HasMajorGridlines = bMajorGridlines;
withBlock.HasMinorGridlines = bMinorGridlines;
}

// .ReversePlotOrder = False 'cannot be used on radar charts

if (sAxisType == "C")
{
// ------------------------- automatic
if ((withBlock.CategoryType == Excel.XlCategoryType.xlAutomaticScale))
{
if (sTickLabelFormat != "")
withBlock.TickLabels.NumberFormat = sTickLabelFormat;
else
withBlock.TickLabels.NumberFormat = "0";

withBlock.TickLabels.Orientation = zReturn_TickLabelOrientation(sTickLabelsOrientation);
}

// ------------------------- category
if ((withBlock.CategoryType == Excel.XlCategoryType.xlCategoryScale))
{
if (sTickLabelFormat != "")
withBlock.TickLabels.NumberFormat = sTickLabelFormat;
else
withBlock.TickLabels.NumberFormat = "General";
withBlock.AxisBetweenCategories = bAxisBetweenCategories;

withBlock.TickLabelSpacing = iTickLabelSpacing;
withBlock.TickMarkSpacing = iTickMarkSpacing;

withBlock.TickLabels.Orientation = zReturn_TickLabelOrientation(sTickLabelsOrientation);
}

// ------------------------- time scale
if ((withBlock.CategoryType == Excel.XlCategoryType.xlTimeScale))
{
if (sTickLabelFormat != "")
withBlock.TickLabels.NumberFormat = sTickLabelFormat;
else
withBlock.TickLabels.NumberFormat = "d-mmm-yy";
withBlock.BaseUnit = zReturn_TimeSeriesUnit(sAxisBaseUnit);

dbnoofdaysdifference = withBlock.MaximumScale - withBlock.MinimumScale;

withBlock.MajorUnit = ChartAxis_XCalculateNoOfLabels(dbnoofdaysdifference);

withBlock.MinorUnit = withBlock.MajorUnit; // default to show no minor tickmarks
withBlock.MajorUnitScale = Excel.XlTimeUnit.xlDays;
withBlock.MinorUnitScale = withBlock.MajorUnitScale;

// .Crosses = lAxisCrossesAt 'not radar charts !

withBlock.AxisBetweenCategories = bAxisBetweenCategories;
withBlock.ReversePlotOrder = false;

withBlock.TickLabels.Orientation = zReturn_TickLabelOrientation(sTickLabelsOrientation);
}
}
}

objChart.HasAxis(zReturn_AxisType(sAxisType), zReturn_AxisGroup(sAxisGroup)) = bAxisShowIt;

clszLateBindingExcel.ChartSelectionActivate(objSelection);
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objAxis = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartAxis_XOptions", msMODULENAME, "define the axis options for the chart axis " + "AxisGroup - " + sAxisGroup + " AxisType - " + sAxisType + " axis.", gobjCOMException, gobjException);
}
}
Public Sub ChartAxis_XOptions(ByVal objChart As Excel.Chart, _
Optional ByVal sAxisGroup As String = "P", _
Optional ByVal sAxisType As String = "V", _
Optional ByVal sAxisCategory As String = "AS", _
Optional ByVal bAxisShowIt As Boolean = True, _
Optional ByVal sAxisBaseUnit As String = "D", _
Optional ByVal sAxisMajorUnit As String = "M", _
Optional ByVal sAxisMinorUnit As String = "M", _
Optional ByVal sMajorTickMarkPos As String = "OU", _
Optional ByVal sMinorTickMarkPos As String = "OU", _
Optional ByVal sTickLabelPos As String = "NA", _
Optional ByVal bMinorGridlines As Boolean = False, _
Optional ByVal bMajorGridlines As Boolean = False, _
Optional ByVal sTickLabelFormat As String = "", _
Optional ByVal sTickLabelsOrientation As String = "AU", _
Optional ByVal iTickLabelSpacing As Integer = 1, _
Optional ByVal iTickMarkSpacing As Integer = 1, _
Optional ByVal bAxisBetweenCategories As Boolean = True, _
Optional ByVal iAxisCrossesAt As Integer = 0)

Dim objSelection As Object
Dim objAxis As Excel.Axis

Try
If clsError.ErrorFlag() = True Then Exit Sub

Dim dbnoofdaysdifference As Double
Dim iminimumdate As Integer
Dim imaximumdate As Integer 'declares for dates

objAxis = CType(objChart.Axes(zReturn_AxisType(sAxisType), _
zReturn_AxisGroup(sAxisGroup)), Excel.Axis)

'this automatically selects the whole chart area
objSelection = gApplication.Selection

objChart.HasAxis(zReturn_AxisType(sAxisType), _
zReturn_AxisGroup(sAxisGroup)) = True

'Throw New System.Exception("testing")

With objAxis
If sAxisType = "C" Then
If (.CategoryType = Excel.XlCategoryType.xlAutomaticScale) Then
.CategoryType = zReturn_AxisCategoryType(sAxisCategory)
End If

If (.CategoryType = Excel.XlCategoryType.xlTimeScale) Or _
(sAxisCategory = "TS") Then
.BaseUnit = zReturn_TimeSeriesUnit(sAxisBaseUnit)
End If
End If

.MinorTickMark = zReturn_TickMarkPosition(sMinorTickMarkPos)
.MajorTickMark = zReturn_TickMarkPosition(sMajorTickMarkPos)

'check that if the chart has gridlines they are deleted ????

.TickLabelPosition = zReturn_TickLabelPosition(sTickLabelPos)

'gridlines only for primary axes except 3D charts ??

'either primary axes either primary or secondary
If sAxisGroup = "P" Then
.HasMajorGridlines = bMajorGridlines
.HasMinorGridlines = bMinorGridlines
' If sAxisType = "C" Then .CrossesAt = lAxisCrossesAt few chart types ?
End If

'.ReversePlotOrder = False 'cannot be used on radar charts

If sAxisType = "C" Then
'------------------------- automatic
If (.CategoryType = Excel.XlCategoryType.xlAutomaticScale) Then
If sTickLabelFormat <> "" Then
.TickLabels.NumberFormat = sTickLabelFormat
Else
.TickLabels.NumberFormat = "0"
End If

.TickLabels.Orientation = _
zReturn_TickLabelOrientation(sTickLabelsOrientation)
End If

'------------------------- category
If (.CategoryType = Excel.XlCategoryType.xlCategoryScale) Then
If sTickLabelFormat <> "" Then
.TickLabels.NumberFormat = sTickLabelFormat
Else
.TickLabels.NumberFormat = "General"
End If
.AxisBetweenCategories = bAxisBetweenCategories

.TickLabelSpacing = iTickLabelSpacing
.TickMarkSpacing = iTickMarkSpacing

.TickLabels.Orientation = _
zReturn_TickLabelOrientation(sTickLabelsOrientation)
End If

'------------------------- time scale
If (.CategoryType = Excel.XlCategoryType.xlTimeScale) Then
If sTickLabelFormat <> "" Then
.TickLabels.NumberFormat = sTickLabelFormat
Else
.TickLabels.NumberFormat = "d-mmm-yy"
End If
.BaseUnit = zReturn_TimeSeriesUnit(sAxisBaseUnit)

dbnoofdaysdifference = .MaximumScale - .MinimumScale

.MajorUnit = ChartAxis_XCalculateNoOfLabels(dbnoofdaysdifference)

.MinorUnit = .MajorUnit 'default to show no minor tickmarks
.MajorUnitScale = Excel.XlTimeUnit.xlDays
.MinorUnitScale = .MajorUnitScale

' .Crosses = lAxisCrossesAt 'not radar charts !

.AxisBetweenCategories = bAxisBetweenCategories
.ReversePlotOrder = False

.TickLabels.Orientation = _
zReturn_TickLabelOrientation(sTickLabelsOrientation)
End If
'-------------------------
End If
End With

objChart.HasAxis(zReturn_AxisType(sAxisType), _
zReturn_AxisGroup(sAxisGroup)) = bAxisShowIt

Call clszLateBindingExcel.ChartSelectionActivate(objSelection)

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objAxis = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartAxis_XOptions", msMODULENAME, _
"define the axis options for the chart axis " & _
"AxisGroup - " & sAxisGroup & " AxisType - " & sAxisType & " axis.", _
gobjCOMException, gobjException)
End If
End Try
End Sub

ChartAxis_YCalculateXLines

public void ChartAxis_YCalculateXLines(int iarrayno, float sngdifference)
{
try
{
if (clsError.ErrorFlag() == true)
return;

// the correct power of 10 to multiple the ideal scale by
float sngMultipleFactor;
int iIdealPowerof10;

// giIdealPowerof10(iarrayno) = clsNumber.ReturnPowerOfTen(sngdifference / iarrayno)
iIdealPowerof10 = clsNumber.ReturnPowerOfTen(sngdifference / (double)iarrayno);

// gsngMultipleFactor = clsNumber.TenToThePowerOf(giIdealPowerof10(iarrayno))
gsngMultipleFactor = clsNumber.TenToThePowerOf(iIdealPowerof10);

giAppScaleMultiple(iarrayno) = System.Convert.ToInt32(ChartAxis_YScaleChoose((sngdifference / (double)iarrayno) * gsngMultipleFactor));

gsngActualScale(iarrayno) = giAppScaleMultiple(iarrayno) / (double)gsngMultipleFactor;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartAxis_YCalculateXLines", msMODULENAME, "calculate the corresponding number of X lines for the " + "Array No: " + iarrayno + " and Difference: " + sngdifference + ".", gobjCOMException, gobjException);
}
}
Public Sub ChartAxis_YCalculateXLines(ByVal iarrayno As Integer, _
ByVal sngdifference As Single)

Try
If clsError.ErrorFlag() = True Then Exit Sub

'the correct power of 10 to multiple the ideal scale by
Dim sngMultipleFactor As Single
Dim iIdealPowerof10 As Integer

'giIdealPowerof10(iarrayno) = clsNumber.ReturnPowerOfTen(sngdifference / iarrayno)
iIdealPowerof10 = clsNumber.ReturnPowerOfTen(sngdifference / iarrayno)

'gsngMultipleFactor = clsNumber.TenToThePowerOf(giIdealPowerof10(iarrayno))
gsngMultipleFactor = clsNumber.TenToThePowerOf(iIdealPowerof10)

giAppScaleMultiple(iarrayno) = _
CInt(ChartAxis_YScaleChoose((sngdifference / iarrayno) * gsngMultipleFactor))

gsngActualScale(iarrayno) = giAppScaleMultiple(iarrayno) / gsngMultipleFactor

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartAxis_YCalculateXLines", msMODULENAME, _
"calculate the corresponding number of X lines for the " & _
"Array No: " & iarrayno & " and Difference: " & sngdifference & ".", _
gobjCOMException, gobjException)
End If
End Try
End Sub

ChartAxis_YDecimalPlaces

public void ChartAxis_YDecimalPlaces(Excel.Chart objChart, string sAxisGroup, string sAxisType, int iDecimalPlaces)
{
Excel.Axis objAxis;
Excel.SeriesCollection objSeriesCol;
Excel.Series objSeries;

try
{
if (clsError.ErrorFlag() == true)
return;

string splaces;
int icount;
bool bstacked100;

splaces = "0.";
for (icount = 0; icount <= iDecimalPlaces - 1; icount++)
splaces = splaces + "0";

objAxis = (Excel.Axis)objChart.Axes(zReturn_AxisType(sAxisType), zReturn_AxisGroup(sAxisGroup));

// -----------------------
objSeriesCol = (Excel.SeriesCollection)objChart.SeriesCollection;

for (icount = 1; icount <= objSeriesCol.Count; icount++) // for all the chart series
{
objSeries = objSeriesCol.Item(icount);

if (Chart_SeriesAxisUsed(objSeries) == sAxisGroup)
{
// is series on the axis
if (ChartType_SeriesTypeIsItStacked100(objSeries) == true)
bstacked100 = true;
}
}
// -----------------------
if (bstacked100 == true)
{
}
else
// therefore chart is not 100% so set the decimal places

// temporarily set to General if RP scaling is not in effect
// objAxis.TickLabels.NumberFormat = "General"

if ((iDecimalPlaces == 0))
objAxis.TickLabels.NumberFormat = "0";
else
objAxis.TickLabels.NumberFormat = splaces;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objChart = null/* TODO Change to default(_) if this is not a reference type */;
objAxis = null/* TODO Change to default(_) if this is not a reference type */;
objSeriesCol = null/* TODO Change to default(_) if this is not a reference type */;
objSeries = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartAxis_YDecimalPlaces", msMODULENAME, "adjust the number of decimal places on the " + "(" + sAxisGroup + ") Y axis.", gobjCOMException, gobjException);
}
}
Public Sub ChartAxis_YDecimalPlaces(ByVal objChart As Excel.Chart, _
ByVal sAxisGroup As String, _
ByVal sAxisType As String, _
ByVal iDecimalPlaces As Integer)

Dim objAxis As Excel.Axis
Dim objSeriesCol As Excel.SeriesCollection
Dim objSeries As Excel.Series

Try
If clsError.ErrorFlag() = True Then Exit Sub

Dim splaces As String
Dim icount As Integer
Dim bstacked100 As Boolean

splaces = "0."
For icount = 0 To iDecimalPlaces - 1
splaces = splaces & "0"
Next icount

objAxis = CType(objChart.Axes(zReturn_AxisType(sAxisType), _
zReturn_AxisGroup(sAxisGroup)), Excel.Axis)

'-----------------------
objSeriesCol = CType(objChart.SeriesCollection, Excel.SeriesCollection)

For icount = 1 To objSeriesCol.Count 'for all the chart series
objSeries = objSeriesCol.Item(icount)

If Chart_SeriesAxisUsed(objSeries) = sAxisGroup Then
'is series on the axis
If ChartType_SeriesTypeIsItStacked100(objSeries) = True Then
bstacked100 = True
End If
End If

Next icount
'-----------------------
If bstacked100 = True Then
'then the axis is for a stacked 100
'decimal places set before in format stacked

Else
'therefore chart is not 100% so set the decimal places

'temporarily set to General if RP scaling is not in effect
'objAxis.TickLabels.NumberFormat = "General"

If (iDecimalPlaces = 0) Then
objAxis.TickLabels.NumberFormat = "0"
Else
objAxis.TickLabels.NumberFormat = splaces
End If

End If

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objChart = Nothing
objAxis = Nothing
objSeriesCol = Nothing
objSeries = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartAxis_YDecimalPlaces", msMODULENAME, _
"adjust the number of decimal places on the " & _
"(" & sAxisGroup & ") Y axis.", _
gobjCOMException, gobjException)
End If
End Try
End Sub

ChartAxis_YScaleAdjustStart

public float ChartAxis_YScaleAdjustStart(float sngSmallest, float sngBestScaleUnits)
{
try
{
if (clsError.ErrorFlag() == true)
return;

int icount;
float sngrunning;

icount = 0; sngrunning = 0; // shouldn't need this ! - why would it be zero
if (sngBestScaleUnits != 0)
{
icount = System.Convert.ToInt32((Math.Abs(sngSmallest) - sngBestScaleUnits) / (double)sngBestScaleUnits);

sngrunning = sngBestScaleUnits * icount;
while (!sngrunning > Math.Abs(sngSmallest))
{
icount = icount + 1;
sngrunning = sngBestScaleUnits * icount;
}
}
if (sngSmallest > 0)
ChartAxes_YScaleAdjustStart = (icount - 1) * sngBestScaleUnits;
if (sngSmallest < 0)
ChartAxes_YScaleAdjustStart = sngrunning;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartAxis_YScaleAdjustStart", msMODULENAME, "return the starting scale for an axis.", gobjCOMException, gobjException);
}
}
Public Function ChartAxis_YScaleAdjustStart(ByVal sngSmallest As Single, _
ByVal sngBestScaleUnits As Single) As Single

Try
If clsError.ErrorFlag() = True Then Exit Function

Dim icount As Integer
Dim sngrunning As Single

icount = 0 : sngrunning = 0 'shouldn't need this ! - why would it be zero
If sngBestScaleUnits <> 0 Then

icount = CInt((Math.Abs(sngSmallest) - sngBestScaleUnits) / sngBestScaleUnits)

sngrunning = sngBestScaleUnits * icount
Do Until sngrunning > Math.Abs(sngSmallest)
icount = icount + 1
sngrunning = sngBestScaleUnits * icount
Loop
End If
If sngSmallest > 0 Then
ChartAxes_YScaleAdjustStart = (icount - 1) * sngBestScaleUnits
End If
If sngSmallest < 0 Then
ChartAxes_YScaleAdjustStart = sngrunning
End If

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartAxis_YScaleAdjustStart", msMODULENAME, _
"return the starting scale for an axis.", _
gobjCOMException, gobjException)
End If
End Try
End Function

ChartAxis_YScaleAdjustToMicrosoft

public void ChartAxis_YScaleAdjustToMicrosoft(Excel.Chart objChart, string sAxisGroup = "P", string sAxisType = "V")
{
try
{
if (clsError.ErrorFlag() == true)
return;

if (ChartAxis_Exists(objChart, sAxisGroup, sAxisType) == true)
ChartAxis_YScaleMicrosoft(objChart, sAxisGroup);
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objChart = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartAxis_YScaleAdjustToMicrosoft", msMODULENAME, "adjusts the scales of the axes to the 'Microsoft Automatic' scaling.", gobjCOMException, gobjException);
}
}
Public Sub ChartAxis_YScaleAdjustToMicrosoft(ByVal objChart As Excel.Chart, _
Optional ByVal sAxisGroup As String = "P", _
Optional ByVal sAxisType As String = "V")

Try
If clsError.ErrorFlag() = True Then Exit Sub

If ChartAxis_Exists(objChart, sAxisGroup, sAxisType) = True Then
Call ChartAxis_YScaleMicrosoft(objChart, sAxisGroup)
End If

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objChart = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartAxis_YScaleAdjustToMicrosoft", msMODULENAME, _
"adjusts the scales of the axes to the 'Microsoft Automatic' scaling.", _
gobjCOMException, gobjException)
End If
End Try
End Sub

ChartAxis_YScaleAdjustToRP

public void ChartAxis_YScaleAdjustToRP(Excel.Chart objChart, string sAxisGroup = "P", string sAxisType = "V", bool bToZeroScaling = false, bool bMicrosoftScale = false)
{
Excel.SeriesCollection objSeriesCol;
Excel.Series objSeries;

try
{
if (clsError.ErrorFlag() == true)
return;

float sngSmallest;
float sngLargest;
int icount;
bool bnotstacked;
bool bmultiplestacked;

System.Array arrseriesvalues;
float[] sngseriesarray;
float[] sngcurrenttotal;

objSeriesCol = (Excel.SeriesCollection)objChart.SeriesCollection;

if (ChartAxis_Exists(objChart, sAxisGroup, sAxisType) == true)
{
bnotstacked = false;
bmultiplestacked = false; // to determine if multiple series are stacked
for (icount = 1; icount <= objSeriesCol.Count; icount++) // for all the chart series
{
objSeries = objSeriesCol.Item(icount);

// is the series on a given axis
if (Chart_SeriesAxisUsed(objSeries) == sAxisGroup)
{
// ------------------------------------------------
if (ChartType_SeriesTypeIsItStacked100(objSeries) == false)
{
arrseriesvalues = (System.Array)objSeries.Values;
sngseriesarray = clsArray.ArrayToSingleArray(arrseriesvalues);

if (ChartType_SeriesTypeIsItStacked(objSeries) == true)
{
// chart is STACKED
// ------------------------------
if (bmultiplestacked == false)
{
// assign this first series to the temp array
sngcurrenttotal = sngseriesarray;

sngSmallest = clsArray.ValueSmallestSingle("Smallest", sngcurrenttotal, sngSmallest);
sngLargest = clsArray.ValueLargestSingle("Largest", sngcurrenttotal, sngLargest);

// first series, so next one will be stacked
bmultiplestacked = true;
}
else
{
sngcurrenttotal = clsArray.Arrays2AddSingle("Current Total", sngcurrenttotal, "Next Series", sngseriesarray);

// calculate smallest & largest from the sum series using this axis
sngSmallest = clsArray.ValueSmallestSingle("Smallest", sngcurrenttotal, sngSmallest);
sngLargest = clsArray.ValueLargestSingle("Largest", sngcurrenttotal, sngLargest);
}
}
else
// ------------------------------
if (bnotstacked == false)
{
sngSmallest = clsArray.ValueSmallestSingle("Smallest", sngseriesarray, sngSmallest);
sngLargest = clsArray.ValueLargestSingle("Largest", sngseriesarray, sngLargest);

bnotstacked = true;
}
else
{
sngSmallest = clsArray.ValueSmallestSingle("Smallest", sngseriesarray, sngSmallest);
sngLargest = clsArray.ValueLargestSingle("Largest", sngseriesarray, sngLargest);
}
}
else if (bMicrosoftScale == false)
{
ChartAxis_YScaleDefine(objChart, sAxisGroup, sAxisType, 0, 100, 20);
ChartAxis_YDecimalPlaces(objChart, sAxisGroup, sAxisType, 0);
return;
}
else
{
ChartAxis_YScaleDefine(objChart, sAxisGroup, sAxisType, 0, 100);
ChartAxis_YDecimalPlaces(objChart, sAxisGroup, sAxisType, 0);
}
}
}

if (bMicrosoftScale == false)
{
if (bToZeroScaling == false)
ChartAxis_YScaleAutomatic(objChart, sAxisGroup, sAxisType, sngSmallest, sngLargest);
else
ChartAxis_YScaleAutomatic(objChart, sAxisGroup, sAxisType, 0, sngLargest);
}
else
{
ChartAxis_YScaleMicrosoft(objChart, sAxisGroup);

// include an option either alwasy have 2 decimal places or automatic
// Call Chart_AxesYDecimalPlaces(objChart, sAxisGroup, sAxisType, 2)
ChartAxis_YScaleMicrosoftAlterDecimalPlaces(objChart, sAxisGroup, sAxisType);
}
}
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objSeriesCol = null/* TODO Change to default(_) if this is not a reference type */;
objSeries = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartAxis_YScaleAdjustToRP", msMODULENAME, "determine the smallest and largest values for the scales on the axis " + " AxisGroup - " + sAxisGroup + " AxisType - " + sAxisType + ".", gobjCOMException, gobjException);
}
}
Public Sub ChartAxis_YScaleAdjustToRP(ByVal objChart As Excel.Chart, _
Optional ByVal sAxisGroup As String = "P", _
Optional ByVal sAxisType As String = "V", _
Optional ByVal bToZeroScaling As Boolean = False, _
Optional ByVal bMicrosoftScale As Boolean = False)

Dim objSeriesCol As Excel.SeriesCollection
Dim objSeries As Excel.Series

Try
If clsError.ErrorFlag() = True Then Exit Sub

Dim sngSmallest As Single
Dim sngLargest As Single
Dim icount As Integer
Dim bnotstacked As Boolean
Dim bmultiplestacked As Boolean

Dim arrseriesvalues As System.Array
Dim sngseriesarray As Single()
Dim sngcurrenttotal As Single()

objSeriesCol = CType(objChart.SeriesCollection, Excel.SeriesCollection)

If ChartAxis_Exists(objChart, sAxisGroup, sAxisType) = True Then
bnotstacked = False
bmultiplestacked = False 'to determine if multiple series are stacked
For icount = 1 To objSeriesCol.Count 'for all the chart series

objSeries = objSeriesCol.Item(icount)

'is the series on a given axis
If Chart_SeriesAxisUsed(objSeries) = sAxisGroup Then
'------------------------------------------------
If ChartType_SeriesTypeIsItStacked100(objSeries) = False Then

arrseriesvalues = CType(objSeries.Values, System.Array)
sngseriesarray = clsArray.ArrayToSingleArray(arrseriesvalues)

If ChartType_SeriesTypeIsItStacked(objSeries) = True Then
'chart is STACKED
'------------------------------
If bmultiplestacked = False Then
'assign this first series to the temp array
sngcurrenttotal = sngseriesarray

sngSmallest = clsArray.ValueSmallestSingle("Smallest", sngcurrenttotal, sngSmallest)
sngLargest = clsArray.ValueLargestSingle("Largest", sngcurrenttotal, sngLargest)

'first series, so next one will be stacked
bmultiplestacked = True
'---------------
Else 'series is stacked on top of a previous series

sngcurrenttotal = clsArray.Arrays2AddSingle("Current Total", sngcurrenttotal, _
"Next Series", sngseriesarray)

'calculate smallest & largest from the sum series using this axis
sngSmallest = clsArray.ValueSmallestSingle("Smallest", sngcurrenttotal, sngSmallest)
sngLargest = clsArray.ValueLargestSingle("Largest", sngcurrenttotal, sngLargest)

End If
'------------------------------
Else 'chart is not STACKED
'------------------------------
If bnotstacked = False Then
sngSmallest = clsArray.ValueSmallestSingle("Smallest", sngseriesarray, sngSmallest)
sngLargest = clsArray.ValueLargestSingle("Largest", sngseriesarray, sngLargest)

bnotstacked = True
Else
sngSmallest = clsArray.ValueSmallestSingle("Smallest", sngseriesarray, sngSmallest)
sngLargest = clsArray.ValueLargestSingle("Largest", sngseriesarray, sngLargest)
End If
'------------------------------
End If
Else
If bMicrosoftScale = False Then
Call ChartAxis_YScaleDefine(objChart, sAxisGroup, sAxisType, 0, 100, 20)
Call ChartAxis_YDecimalPlaces(objChart, sAxisGroup, sAxisType, 0)
Exit Sub
Else
Call ChartAxis_YScaleDefine(objChart, sAxisGroup, sAxisType, 0, 100)
Call ChartAxis_YDecimalPlaces(objChart, sAxisGroup, sAxisType, 0)
End If
End If
'------------------------------------------------
End If
Next icount

If bMicrosoftScale = False Then
If bToZeroScaling = False Then
Call ChartAxis_YScaleAutomatic(objChart, sAxisGroup, sAxisType, _
sngSmallest, sngLargest)
Else
Call ChartAxis_YScaleAutomatic(objChart, sAxisGroup, sAxisType, _
0, sngLargest)
End If
Else
Call ChartAxis_YScaleMicrosoft(objChart, sAxisGroup)

'include an option either alwasy have 2 decimal places or automatic
'Call Chart_AxesYDecimalPlaces(objChart, sAxisGroup, sAxisType, 2)
Call ChartAxis_YScaleMicrosoftAlterDecimalPlaces(objChart, sAxisGroup, sAxisType)

End If
End If

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objSeriesCol = Nothing
objSeries = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartAxis_YScaleAdjustToRP", msMODULENAME, _
"determine the smallest and largest values for the scales on the axis " & _
" AxisGroup - " & sAxisGroup & " AxisType - " & sAxisType & ".", _
gobjCOMException, gobjException)
End If
End Try
End Sub

ChartAxis_YScaleAdjustToRPBracket

public void ChartAxis_YScaleAdjustToRPBracket(Excel.Chart objChart, string sAxisGroup, string sAxisType, float sngsmallestvalue, float snglargestvalue, float sngIdealStart, float sngIdealFinish, float sngIdealScale)
{
try
{
if (clsError.ErrorFlag() == true)
return;

float sngBestScaleUnits;
int iarrayno;
float sngdifference;
float sngSmallest;
float sngLargest;
float sngstartscale;
float sngfinishscale;

sngSmallest = clsNumber.SmallestOneSingle(sngsmallestvalue, snglargestvalue);
sngLargest = clsNumber.LargestOneSingle(sngsmallestvalue, snglargestvalue);
sngdifference = Math.Abs(sngIdealFinish - sngIdealStart);

if (clsNumber.IsItInRange(sngSmallest, sngIdealStart, sngIdealFinish) == true & clsNumber.IsItInRange(sngLargest, sngIdealStart, sngIdealFinish) == true)
{
;/* Cannot convert RedimClauseSyntax, System.InvalidCastException: Unable to cast object of type 'Microsoft.CodeAnalysis.VisualBasic.Symbols.ErrorTypeSymbol' to type 'Microsoft.CodeAnalysis.IArrayTypeSymbol'.
at ICSharpCode.CodeConverter.CSharp.VisualBasicConverter.MethodBodyVisitor.VisitRedimClause(RedimClauseSyntax node) in /home/runner/work/CodeConverter/CodeConverter/.temp/codeconverter/ICSharpCode.CodeConverter/CSharp/MethodBodyVisitor.cs:line 140
at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxVisitor`1.Visit(SyntaxNode node)
at ICSharpCode.CodeConverter.CSharp.CommentConvertingMethodBodyVisitor.DefaultVisit(SyntaxNode node) in /home/runner/work/CodeConverter/CodeConverter/.temp/codeconverter/ICSharpCode.CodeConverter/CSharp/CommentConvertingMethodBodyVisitor.cs:line 27

Input:
giAppScaleMultiple(giDEF_AXISSCALEMAX)

*/
;/* Cannot convert RedimClauseSyntax, System.InvalidCastException: Unable to cast object of type 'Microsoft.CodeAnalysis.VisualBasic.Symbols.ErrorTypeSymbol' to type 'Microsoft.CodeAnalysis.IArrayTypeSymbol'.
at ICSharpCode.CodeConverter.CSharp.VisualBasicConverter.MethodBodyVisitor.VisitRedimClause(RedimClauseSyntax node) in /home/runner/work/CodeConverter/CodeConverter/.temp/codeconverter/ICSharpCode.CodeConverter/CSharp/MethodBodyVisitor.cs:line 140
at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxVisitor`1.Visit(SyntaxNode node)
at ICSharpCode.CodeConverter.CSharp.CommentConvertingMethodBodyVisitor.DefaultVisit(SyntaxNode node) in /home/runner/work/CodeConverter/CodeConverter/.temp/codeconverter/ICSharpCode.CodeConverter/CSharp/CommentConvertingMethodBodyVisitor.cs:line 27

Input:
gsngActualScale(giDEF_AXISSCALEMAX)

*/

for (iarrayno = giDEF_AXISSCALEMIN; iarrayno <= giDEF_AXISSCALEMAX; iarrayno++)
ChartAxis_YCalculateXLines(iarrayno, sngdifference);

sngstartscale = sngIdealStart;
sngBestScaleUnits = sngIdealScale; // use the ideal scale given
giNoofLinesChosen = System.Convert.ToInt32(((sngIdealFinish - sngIdealStart) / (double)sngIdealScale));
gsngMultipleFactor = clsNumber.TenToThePowerOf(giNoofLinesChosen);
sngfinishscale = sngIdealFinish;
ChartAxis_YScaleDefine(objChart, sAxisGroup, sAxisType, sngstartscale, sngfinishscale, sngBestScaleUnits);

ChartAxis_YScaleAlterDecimalPlaces(objChart, sAxisGroup, sAxisType, sngBestScaleUnits);
}
else
{
sngSmallest = ChartAxis_SmallestAdjustment(sngSmallest, sngLargest, gsngBRACKETCHARTACCURACY); // fn above
sngLargest = ChartAxis_LargestAdjustment(sngSmallest, sngLargest, gsngBRACKETCHARTACCURACY); // fn above
sngfinishscale = sngSmallest;
if (((sngLargest - sngSmallest) < sngdifference))
{
while (!(sngfinishscale > sngLargest)) // repeat until the scale is suitable
{
sngBestScaleUnits = sngIdealScale; // use the ideal scale given

sngstartscale = ChartAxis_YScaleGetStart(objChart, sngSmallest, sngBestScaleUnits);

giNoofLinesChosen = System.Convert.ToInt32(((sngIdealFinish - sngIdealStart) / (double)sngIdealScale));

gsngMultipleFactor = clsNumber.TenToThePowerOf(giNoofLinesChosen);

sngfinishscale = ChartAxis_YScaleGetFinish(objChart, sngstartscale, sngBestScaleUnits);

// increments diff. if not successful
sngIdealFinish = System.Convert.ToSingle((sngIdealFinish * 1.01));
}

ChartAxis_YScaleDefine(objChart, sAxisGroup, sAxisType, sngstartscale, sngfinishscale, sngBestScaleUnits);

ChartAxis_YScaleAlterDecimalPlaces(objChart, sAxisGroup, sAxisType, sngBestScaleUnits);
}
else
ChartAxis_YScaleAutomatic(objChart, sAxisGroup, sAxisType, sngSmallest, sngLargest);
}
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartAxis_YScaleAdjustToRPBracket", msMODULENAME, "adjust the scales of the axes to the 'RP Bracket Automatic' scaling.", gobjCOMException, gobjException);
}
}
Public Sub ChartAxis_YScaleAdjustToRPBracket(ByVal objChart As Excel.Chart, _
ByVal sAxisGroup As String, _
ByVal sAxisType As String, _
ByVal sngsmallestvalue As Single, _
ByVal snglargestvalue As Single, _
ByVal sngIdealStart As Single, _
ByVal sngIdealFinish As Single, _
ByVal sngIdealScale As Single)

Try
If clsError.ErrorFlag() = True Then Exit Sub

Dim sngBestScaleUnits As Single
Dim iarrayno As Integer
Dim sngdifference As Single
Dim sngSmallest As Single
Dim sngLargest As Single
Dim sngstartscale As Single
Dim sngfinishscale As Single

sngSmallest = clsNumber.SmallestOneSingle(sngsmallestvalue, snglargestvalue)
sngLargest = clsNumber.LargestOneSingle(sngsmallestvalue, snglargestvalue)
sngdifference = Math.Abs(sngIdealFinish - sngIdealStart)

If clsNumber.IsItInRange(sngSmallest, sngIdealStart, sngIdealFinish) = True And _
clsNumber.IsItInRange(sngLargest, sngIdealStart, sngIdealFinish) = True Then

ReDim giAppScaleMultiple(giDEF_AXISSCALEMAX)
ReDim gsngActualScale(giDEF_AXISSCALEMAX)

For iarrayno = giDEF_AXISSCALEMIN To giDEF_AXISSCALEMAX
Call ChartAxis_YCalculateXLines(iarrayno, sngdifference)
Next iarrayno

sngstartscale = sngIdealStart
sngBestScaleUnits = sngIdealScale 'use the ideal scale given
giNoofLinesChosen = CInt(((sngIdealFinish - sngIdealStart) / sngIdealScale))
gsngMultipleFactor = clsNumber.TenToThePowerOf(giNoofLinesChosen)
sngfinishscale = sngIdealFinish
Call ChartAxis_YScaleDefine(objChart, sAxisGroup, sAxisType, _
sngstartscale, sngfinishscale, _
sngBestScaleUnits)

Call ChartAxis_YScaleAlterDecimalPlaces(objChart, sAxisGroup, sAxisType, _
sngBestScaleUnits)
Else
sngSmallest = ChartAxis_SmallestAdjustment(sngSmallest, sngLargest, _
gsngBRACKETCHARTACCURACY) 'fn above
sngLargest = ChartAxis_LargestAdjustment(sngSmallest, sngLargest, _
gsngBRACKETCHARTACCURACY) 'fn above
sngfinishscale = sngSmallest
If ((sngLargest - sngSmallest) < sngdifference) Then
Do Until (sngfinishscale > sngLargest) 'repeat until the scale is suitable
sngBestScaleUnits = sngIdealScale 'use the ideal scale given

sngstartscale = _
ChartAxis_YScaleGetStart(objChart, sngSmallest, sngBestScaleUnits)

giNoofLinesChosen = _
CInt(((sngIdealFinish - sngIdealStart) / sngIdealScale))

gsngMultipleFactor = clsNumber.TenToThePowerOf(giNoofLinesChosen)

sngfinishscale = _
ChartAxis_YScaleGetFinish(objChart, sngstartscale, sngBestScaleUnits)

'increments diff. if not successful
sngIdealFinish = CSng((sngIdealFinish * 1.01))
Loop

Call ChartAxis_YScaleDefine(objChart, sAxisGroup, sAxisType, _
sngstartscale, sngfinishscale, _
sngBestScaleUnits)

Call ChartAxis_YScaleAlterDecimalPlaces(objChart, sAxisGroup, sAxisType, _
sngBestScaleUnits)
Else
Call ChartAxis_YScaleAutomatic(objChart, sAxisGroup, sAxisType, _
sngSmallest, sngLargest)
End If
End If

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartAxis_YScaleAdjustToRPBracket", msMODULENAME, _
"adjust the scales of the axes to the 'RP Bracket Automatic' scaling.", _
gobjCOMException, gobjException)
End If
End Try
End Sub

ChartAxis_YScaleAlterDecimalPlaces

public void ChartAxis_YScaleAlterDecimalPlaces(Excel.Chart objChart, string sAxisGroup, string sAxisType, float sngBestScaleUnits)
{
try
{
if (clsError.ErrorFlag() == true)
return;

if ((clsNumber.ReturnPowerOfTen(sngBestScaleUnits) >= 1))
{
if ((gsngMultipleFactor == 15) | (gsngMultipleFactor == 25))
ChartAxis_YDecimalPlaces(objChart, sAxisGroup, sAxisType, clsNumber.ReturnPowerOfTen(sngBestScaleUnits));
else
ChartAxis_YDecimalPlaces(objChart, sAxisGroup, sAxisType, clsNumber.ReturnPowerOfTen(sngBestScaleUnits) - 1);
}
else
ChartAxis_YDecimalPlaces(objChart, sAxisGroup, sAxisType, 0);
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objChart = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartAxis_YScaleAlterDecimalPlaces", msMODULENAME, "adjust the number of decimal places on the " + "Axis Group - " + sAxisGroup + ".", gobjCOMException, gobjException);
}
}
Public Sub ChartAxis_YScaleAlterDecimalPlaces(ByVal objChart As Excel.Chart, _
ByVal sAxisGroup As String, _
ByVal sAxisType As String, _
ByVal sngBestScaleUnits As Single)

Try
If clsError.ErrorFlag() = True Then Exit Sub

If (clsNumber.ReturnPowerOfTen(sngBestScaleUnits) >= 1) Then
If (gsngMultipleFactor = 15) Or (gsngMultipleFactor = 25) Then

Call ChartAxis_YDecimalPlaces(objChart, sAxisGroup, sAxisType, _
clsNumber.ReturnPowerOfTen(sngBestScaleUnits))
Else
Call ChartAxis_YDecimalPlaces(objChart, sAxisGroup, sAxisType, _
clsNumber.ReturnPowerOfTen(sngBestScaleUnits) - 1)
End If
Else 'scale is greater than 10, so no decimal places required
Call ChartAxis_YDecimalPlaces(objChart, sAxisGroup, sAxisType, 0)
End If

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objChart = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartAxis_YScaleAlterDecimalPlaces", msMODULENAME, _
"adjust the number of decimal places on the " & _
"Axis Group - " & sAxisGroup & ".", _
gobjCOMException, gobjException)
End If
End Try
End Sub

ChartAxis_YScaleAutomatic

public void ChartAxis_YScaleAutomatic(Excel.Chart objChart, string sAxisGroup, string sAxisType, float sngsmallestvalue, float snglargestvalue)
{
try
{
if (clsError.ErrorFlag() == true)
return;

int iarrayno;
float sngstartscale;
float sngfinishscale;
float sngSmallest;
float sngLargest;
float sngdifference;
float sngBestScaleUnits;

sngSmallest = clsNumber.SmallestOneSingle(sngsmallestvalue, snglargestvalue);

sngLargest = clsNumber.LargestOneSingle(sngsmallestvalue, snglargestvalue);

sngSmallest = ChartAxis_SmallestAdjustment(sngSmallest, sngLargest);

sngLargest = ChartAxis_LargestAdjustment(sngSmallest, sngLargest);

// calculate the actual difference
sngdifference = Math.Abs(sngLargest - sngSmallest);

sngfinishscale = sngSmallest;

// repeat until the scale is suitable
while (!(sngfinishscale > sngLargest))
{
;/* Cannot convert RedimClauseSyntax, System.InvalidCastException: Unable to cast object of type 'Microsoft.CodeAnalysis.VisualBasic.Symbols.ErrorTypeSymbol' to type 'Microsoft.CodeAnalysis.IArrayTypeSymbol'.
at ICSharpCode.CodeConverter.CSharp.VisualBasicConverter.MethodBodyVisitor.VisitRedimClause(RedimClauseSyntax node) in /home/runner/work/CodeConverter/CodeConverter/.temp/codeconverter/ICSharpCode.CodeConverter/CSharp/MethodBodyVisitor.cs:line 140
at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxVisitor`1.Visit(SyntaxNode node)
at ICSharpCode.CodeConverter.CSharp.CommentConvertingMethodBodyVisitor.DefaultVisit(SyntaxNode node) in /home/runner/work/CodeConverter/CodeConverter/.temp/codeconverter/ICSharpCode.CodeConverter/CSharp/CommentConvertingMethodBodyVisitor.cs:line 27

Input:
giAppScaleMultiple(giDEF_AXISSCALEMAX)

*/
;/* Cannot convert RedimClauseSyntax, System.InvalidCastException: Unable to cast object of type 'Microsoft.CodeAnalysis.VisualBasic.Symbols.ErrorTypeSymbol' to type 'Microsoft.CodeAnalysis.IArrayTypeSymbol'.
at ICSharpCode.CodeConverter.CSharp.VisualBasicConverter.MethodBodyVisitor.VisitRedimClause(RedimClauseSyntax node) in /home/runner/work/CodeConverter/CodeConverter/.temp/codeconverter/ICSharpCode.CodeConverter/CSharp/MethodBodyVisitor.cs:line 140
at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxVisitor`1.Visit(SyntaxNode node)
at ICSharpCode.CodeConverter.CSharp.CommentConvertingMethodBodyVisitor.DefaultVisit(SyntaxNode node) in /home/runner/work/CodeConverter/CodeConverter/.temp/codeconverter/ICSharpCode.CodeConverter/CSharp/CommentConvertingMethodBodyVisitor.cs:line 27

Input:
gsngActualScale(giDEF_AXISSCALEMAX)

*/

for (iarrayno = giDEF_AXISSCALEMIN; iarrayno <= giDEF_AXISSCALEMAX; iarrayno++)
ChartAxis_YCalculateXLines(iarrayno, sngdifference);

// calculates the best scale
sngBestScaleUnits = ChartAxis_YScaleChooseBest();

sngstartscale = ChartAxis_YScaleGetStart(objChart, sngSmallest, sngBestScaleUnits);

sngfinishscale = ChartAxis_YScaleGetFinish(objChart, sngstartscale, sngBestScaleUnits);

// increments diff. if not successful
sngdifference = System.Convert.ToSingle((sngdifference * 1.01));
}

ChartAxis_YScaleDefine(objChart, sAxisGroup, sAxisType, sngstartscale, sngfinishscale, sngBestScaleUnits);

ChartAxis_YScaleAlterDecimalPlaces(objChart, sAxisGroup, sAxisType, sngBestScaleUnits);
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objChart = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartAxis_YScaleAutomatic", msMODULENAME, "adjust the scales of the axes to the 'RP Automatic' scaling.", gobjCOMException, gobjException);
}
}
Public Sub ChartAxis_YScaleAutomatic(ByVal objChart As Excel.Chart, _
ByVal sAxisGroup As String, _
ByVal sAxisType As String, _
ByVal sngsmallestvalue As Single, _
ByVal snglargestvalue As Single)

Try
If clsError.ErrorFlag() = True Then Exit Sub

Dim iarrayno As Integer
Dim sngstartscale As Single
Dim sngfinishscale As Single
Dim sngSmallest As Single
Dim sngLargest As Single
Dim sngdifference As Single
Dim sngBestScaleUnits As Single

sngSmallest = clsNumber.SmallestOneSingle(sngsmallestvalue, snglargestvalue)

sngLargest = clsNumber.LargestOneSingle(sngsmallestvalue, snglargestvalue)

sngSmallest = ChartAxis_SmallestAdjustment(sngSmallest, sngLargest)

sngLargest = ChartAxis_LargestAdjustment(sngSmallest, sngLargest)

'calculate the actual difference
sngdifference = Math.Abs(sngLargest - sngSmallest)

sngfinishscale = sngSmallest

'repeat until the scale is suitable
Do Until (sngfinishscale > sngLargest)

ReDim giAppScaleMultiple(giDEF_AXISSCALEMAX)
ReDim gsngActualScale(giDEF_AXISSCALEMAX)

For iarrayno = giDEF_AXISSCALEMIN To giDEF_AXISSCALEMAX
Call ChartAxis_YCalculateXLines(iarrayno, sngdifference)
Next iarrayno

'calculates the best scale
sngBestScaleUnits = ChartAxis_YScaleChooseBest()

sngstartscale = ChartAxis_YScaleGetStart(objChart, sngSmallest, _
sngBestScaleUnits)

sngfinishscale = ChartAxis_YScaleGetFinish(objChart, sngstartscale, _
sngBestScaleUnits)

'increments diff. if not successful
sngdifference = CSng((sngdifference * 1.01))
Loop

Call ChartAxis_YScaleDefine(objChart, sAxisGroup, sAxisType, _
sngstartscale, sngfinishscale, _
sngBestScaleUnits)

Call ChartAxis_YScaleAlterDecimalPlaces(objChart, sAxisGroup, sAxisType, _
sngBestScaleUnits)

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objChart = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartAxis_YScaleAutomatic", msMODULENAME, _
"adjust the scales of the axes to the 'RP Automatic' scaling.", _
gobjCOMException, gobjException)
End If
End Try
End Sub

ChartAxis_YScaleChoose

public float ChartAxis_YScaleChoose(float sngIdealScale)
{
try
{
if (clsError.ErrorFlag() == true)
return;

if ((10 < sngIdealScale) & (sngIdealScale <= 15))
ChartAxis_YScaleChoose = 15;
if ((15 < sngIdealScale) & (sngIdealScale <= 20))
ChartAxis_YScaleChoose = 20;
if ((20 < sngIdealScale) & (sngIdealScale <= 25))
ChartAxis_YScaleChoose = 25;
if ((25 < sngIdealScale) & (sngIdealScale <= 50))
ChartAxis_YScaleChoose = 50;
if ((50 < sngIdealScale) & (sngIdealScale <= 100))
ChartAxis_YScaleChoose = 100;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartAxis_YScaleChoose", msMODULENAME, "choose the best scale for an axis.", gobjCOMException, gobjException);
}
}
Public Function ChartAxis_YScaleChoose(ByVal sngIdealScale As Single) _
As Single

Try
If clsError.ErrorFlag() = True Then Exit Function

If (10 < sngIdealScale) And (sngIdealScale <= 15) Then ChartAxis_YScaleChoose = 15
If (15 < sngIdealScale) And (sngIdealScale <= 20) Then ChartAxis_YScaleChoose = 20
If (20 < sngIdealScale) And (sngIdealScale <= 25) Then ChartAxis_YScaleChoose = 25
If (25 < sngIdealScale) And (sngIdealScale <= 50) Then ChartAxis_YScaleChoose = 50
If (50 < sngIdealScale) And (sngIdealScale <= 100) Then ChartAxis_YScaleChoose = 100

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartAxis_YScaleChoose", msMODULENAME, _
"choose the best scale for an axis.", _
gobjCOMException, gobjException)
End If
End Try
End Function

ChartAxis_YScaleChooseBest

public float ChartAxis_YScaleChooseBest(float sngIdealScale = 0)
{
try
{
if (clsError.ErrorFlag() == true)
return;

int iarrayno;
float sngsmallestunit;

if (sngIdealScale == 0)
{
// max no. of lines first
sngsmallestunit = gsngActualScale(giDEF_AXISSCALEMAX);

// start at maxno. of lines
for (iarrayno = giDEF_AXISSCALEMAX; iarrayno >= giDEF_AXISSCALEMIN; iarrayno += -1)
{
if ((gsngActualScale(iarrayno) <= sngsmallestunit))
{
sngsmallestunit = gsngActualScale(iarrayno);
giNoofLinesChosen = iarrayno;
gsngMultipleFactor = giAppScaleMultiple(iarrayno);
}
}
}
else
sngsmallestunit = sngIdealScale;

ChartAxis_YScaleChooseBest = sngsmallestunit;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartAxis_YScaleChooseBest", msMODULENAME, "choose the best scale for the Y-axis.", gobjCOMException, gobjException);
}
}
Public Function ChartAxis_YScaleChooseBest(Optional ByVal sngIdealScale As Single = 0) _
As Single

Try
If clsError.ErrorFlag() = True Then Exit Function

Dim iarrayno As Integer
Dim sngsmallestunit As Single

If sngIdealScale = 0 Then
'max no. of lines first
sngsmallestunit = gsngActualScale(giDEF_AXISSCALEMAX)

'start at maxno. of lines
For iarrayno = giDEF_AXISSCALEMAX To giDEF_AXISSCALEMIN Step -1

If (gsngActualScale(iarrayno) <= sngsmallestunit) Then
sngsmallestunit = gsngActualScale(iarrayno)
giNoofLinesChosen = iarrayno
gsngMultipleFactor = giAppScaleMultiple(iarrayno)
End If

Next iarrayno

Else
sngsmallestunit = sngIdealScale
End If

ChartAxis_YScaleChooseBest = sngsmallestunit

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartAxis_YScaleChooseBest", msMODULENAME, _
"choose the best scale for the Y-axis.", _
gobjCOMException, gobjException)
End If

End Try
End Function

ChartAxis_YScaleDefine

public void ChartAxis_YScaleDefine(Excel.Chart objChart, string sAxisGroup, string sAxisType, float sngMinimum, float sngMaximum, float sngMajorUnit = 0, string sChartName = "", string sWshName = "")
{
Excel.Axis objAxis;

try
{
if (clsError.ErrorFlag() == true)
return;

objAxis = (Excel.Axis)objChart.Axes(zReturn_AxisType(sAxisType), zReturn_AxisGroup(sAxisGroup));

{
var withBlock = objAxis;
withBlock.MinimumScale = sngMinimum;
withBlock.MaximumScale = sngMaximum;

// maybe assign to the minor unit as well - to be sure ???
if (sngMajorUnit > 0)
withBlock.MajorUnit = sngMajorUnit; // assign the new max,min and unit
}
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objAxis = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartAxis_YScaleDefine", msMODULENAME, "define the scale for the AxisGroup - " + sAxisGroup + ".", gobjCOMException, gobjException);
}
}
Public Sub ChartAxis_YScaleDefine(ByVal objChart As Excel.Chart, _
ByVal sAxisGroup As String, _
ByVal sAxisType As String, _
ByVal sngMinimum As Single, _
ByVal sngMaximum As Single, _
Optional ByVal sngMajorUnit As Single = 0, _
Optional ByVal sChartName As String = "", _
Optional ByVal sWshName As String = "")

Dim objAxis As Excel.Axis

Try
If clsError.ErrorFlag() = True Then Exit Sub

objAxis = CType(objChart.Axes(zReturn_AxisType(sAxisType), _
zReturn_AxisGroup(sAxisGroup)), Excel.Axis)

With objAxis
.MinimumScale = sngMinimum
.MaximumScale = sngMaximum

'maybe assign to the minor unit as well - to be sure ???
If sngMajorUnit > 0 Then .MajorUnit = sngMajorUnit 'assign the new max,min and unit
End With

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objAxis = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartAxis_YScaleDefine", msMODULENAME, _
"define the scale for the AxisGroup - " & sAxisGroup & ".", _
gobjCOMException, gobjException)
End If

End Try
End Sub

ChartAxis_YScaleGetFinish

public float ChartAxis_YScaleGetFinish(Excel.Chart objChart, float sngstartscale, float sngBestScaleUnits)
{
try
{
if (clsError.ErrorFlag() == true)
return;

ChartAxis_YScaleGetFinish = sngstartscale + (sngBestScaleUnits * giNoofLinesChosen);
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartAxis_YScaleGetFinish", msMODULENAME, "return the calculated largest value for the scale of an axis.", gobjCOMException, gobjException);
}
}
Public Function ChartAxis_YScaleGetFinish(ByVal objChart As Excel.Chart, _
ByVal sngstartscale As Single, _
ByVal sngBestScaleUnits As Single) _
As Single

Try
If clsError.ErrorFlag() = True Then Exit Function

ChartAxis_YScaleGetFinish = sngstartscale + (sngBestScaleUnits * giNoofLinesChosen)

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartAxis_YScaleGetFinish", msMODULENAME, _
"return the calculated largest value for the scale of an axis.", _
gobjCOMException, gobjException)
End If

End Try
End Function

ChartAxis_YScaleGetStart

public float ChartAxis_YScaleGetStart(Excel.Chart objChart, float sngSmallest, float sngBestScaleUnits)
{
try
{
if (clsError.ErrorFlag() == true)
return;

if ((sngSmallest == sngBestScaleUnits) | (sngSmallest == 0))
ChartAxis_YScaleGetStart = sngSmallest;
else if (sngSmallest > 0)
ChartAxis_YScaleGetStart = ChartAxes_YScaleAdjustStart(sngSmallest, sngBestScaleUnits);
else if (sngSmallest < 0)
ChartAxis_YScaleGetStart = -ChartAxes_YScaleAdjustStart(sngSmallest, sngBestScaleUnits);
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objChart = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartAxis_YScaleGetStart", msMODULENAME, "return the calculated smallest value for for the scale of an axis.", gobjCOMException, gobjException);
}
}
Public Function ChartAxis_YScaleGetStart(ByVal objChart As Excel.Chart, _
ByVal sngSmallest As Single, _
ByVal sngBestScaleUnits As Single) _
As Single

Try
If clsError.ErrorFlag() = True Then Exit Function

If (sngSmallest = sngBestScaleUnits) Or (sngSmallest = 0) Then
ChartAxis_YScaleGetStart = sngSmallest

ElseIf sngSmallest > 0 Then
ChartAxis_YScaleGetStart = _
ChartAxes_YScaleAdjustStart(sngSmallest, sngBestScaleUnits)

ElseIf sngSmallest < 0 Then
ChartAxis_YScaleGetStart = _
-ChartAxes_YScaleAdjustStart(sngSmallest, sngBestScaleUnits)
End If

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objChart = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartAxis_YScaleGetStart", msMODULENAME, _
"return the calculated smallest value for for the scale of an axis.", _
gobjCOMException, gobjException)
End If
End Try
End Function

ChartAxis_YScaleMicrosoft

public void ChartAxis_YScaleMicrosoft(Excel.Chart objChart, string sAxisGroup)
{
Excel.Axis objAxis;

try
{
if (clsError.ErrorFlag() == true)
return;

if (sAxisGroup == "P")
objAxis = (Excel.Axis)objChart.Axes(Excel.XlAxisType.xlValue, Excel.XlAxisGroup.xlPrimary);
if (sAxisGroup == "S")
objAxis = (Excel.Axis)objChart.Axes(Excel.XlAxisType.xlValue, Excel.XlAxisGroup.xlSecondary);
if ((sAxisGroup != "P") & (sAxisGroup != "S"))
{
MsgBox("Error - Chart_AxesYScaleMicrosoft");
return;
}

{
var withBlock = objAxis;
withBlock.MinimumScaleIsAuto = true;
withBlock.MaximumScaleIsAuto = true;
withBlock.MinorUnitIsAuto = true;
withBlock.MajorUnitIsAuto = true; // set all the automatic settings to true
}
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objAxis = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartAxis_YScaleMicrosoft", msMODULENAME, "define the scale for the AxisGroup - " + sAxisGroup + "to be the \"Microsoft Automatic\" Scaling.", gobjCOMException, gobjException);
}
}
Public Sub ChartAxis_YScaleMicrosoft(ByVal objChart As Excel.Chart, _
ByVal sAxisGroup As String)

Dim objAxis As Excel.Axis

Try
If clsError.ErrorFlag() = True Then Exit Sub

If sAxisGroup = "P" Then
objAxis = CType(objChart.Axes(Excel.XlAxisType.xlValue, _
Excel.XlAxisGroup.xlPrimary), Excel.Axis)
End If
If sAxisGroup = "S" Then
objAxis = CType(objChart.Axes(Excel.XlAxisType.xlValue, _
Excel.XlAxisGroup.xlSecondary), Excel.Axis)
End If
If (sAxisGroup <> "P") And (sAxisGroup <> "S") Then
Call MsgBox("Error - Chart_AxesYScaleMicrosoft")
Exit Sub
End If

With objAxis
.MinimumScaleIsAuto = True
.MaximumScaleIsAuto = True
.MinorUnitIsAuto = True
.MajorUnitIsAuto = True 'set all the automatic settings to true
End With

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objAxis = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartAxis_YScaleMicrosoft", msMODULENAME, _
"define the scale for the AxisGroup - " & sAxisGroup & _
"to be the ""Microsoft Automatic"" Scaling.", _
gobjCOMException, gobjException)
End If
End Try
End Sub

ChartAxis_YScaleMicrosoftAlterDecimalPlaces

public void ChartAxis_YScaleMicrosoftAlterDecimalPlaces(Excel.Chart objChart, string sAxisGroup, string sAxisType)
{
Excel.Axis objAxis;

try
{
if (clsError.ErrorFlag() == true)
return;

float sngscaleunits;

if (sAxisGroup == "P")
objAxis = (Excel.Axis)objChart.Axes(Excel.XlAxisType.xlValue, Excel.XlAxisGroup.xlPrimary);
if (sAxisGroup == "S")
objAxis = (Excel.Axis)objChart.Axes(Excel.XlAxisType.xlValue, Excel.XlAxisGroup.xlSecondary);

{
var withBlock = objAxis;
sngscaleunits = System.Convert.ToSingle(withBlock.MajorUnit);
}

if ((clsNumber.ReturnPowerOfTen(sngscaleunits) >= 1))
ChartAxis_YDecimalPlaces(objChart, sAxisGroup, sAxisType, clsNumber.ReturnPowerOfTen(sngscaleunits) - 1);
else
ChartAxis_YDecimalPlaces(objChart, sAxisGroup, sAxisType, 0);
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objChart = null/* TODO Change to default(_) if this is not a reference type */;
objAxis = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartAxis_YScaleMicrosoftAlterDecimalPlaces", msMODULENAME, "adjust the number of decimal places on the " + "Axis Group - " + sAxisGroup + ".", gobjCOMException, gobjException);
}
}
Public Sub ChartAxis_YScaleMicrosoftAlterDecimalPlaces(ByVal objChart As Excel.Chart, _
ByVal sAxisGroup As String, _
ByVal sAxisType As String)

Dim objAxis As Excel.Axis

Try
If clsError.ErrorFlag() = True Then Exit Sub

Dim sngscaleunits As Single

If sAxisGroup = "P" Then
objAxis = CType(objChart.Axes(Excel.XlAxisType.xlValue, _
Excel.XlAxisGroup.xlPrimary), Excel.Axis)
End If
If sAxisGroup = "S" Then
objAxis = CType(objChart.Axes(Excel.XlAxisType.xlValue, _
Excel.XlAxisGroup.xlSecondary), Excel.Axis)
End If

With objAxis
sngscaleunits = CSng(.MajorUnit)
End With

If (clsNumber.ReturnPowerOfTen(sngscaleunits) >= 1) Then
Call ChartAxis_YDecimalPlaces(objChart, sAxisGroup, sAxisType, _
clsNumber.ReturnPowerOfTen(sngscaleunits) - 1)

Else 'scale is greater than 10, so no decimal places required
Call ChartAxis_YDecimalPlaces(objChart, sAxisGroup, sAxisType, 0)
End If

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objChart = Nothing
objAxis = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartAxis_YScaleMicrosoftAlterDecimalPlaces", msMODULENAME, _
"adjust the number of decimal places on the " & _
"Axis Group - " & sAxisGroup & ".", _
gobjCOMException, gobjException)
End If
End Try
End Sub

ChartFormat_ChartArea

public void ChartFormat_ChartArea(Excel.Chart objChart, string sFontName = "AR", float sngFontSize = 10, int iFontColourIdx = 1, string sFontBackground = "AU", bool bBold = false, bool bItalic = false, string sUnderline = "NO", bool bStrikethrough = false, bool bSubscript = false, bool bSuperscript = false, int iBorderColour = 0, int iBorderWeight = 1, string sBorderLineStyle = "NO", bool bShadow = false, int iInteriorColourIdx = 2, string sInteriorPatternStyle = "NO", int iFillForeColour = 1, int iFillBackColour = 1, bool bFillAsSolid = true, string sGradientColourType = "0", string sGradientStyle = "HR", int iGradientVariant = 0, float sngGradientDegree = 0.5, string sGradientPresetType = "", string sTexturePresetType = "NO", string sFillPatternStyle = "NO")
{
Excel.ChartArea objChartArea;
Excel.Font objFont;

try
{
if (clsError.ErrorFlag() == true)
return;

objChartArea = objChart.ChartArea;

{
var withBlock = objChartArea;
withBlock.AutoScaleFont = false; // prevents the Not Enough Memory error

objFont = withBlock.Font;
{
var withBlock1 = objFont;
withBlock1.Name = zReturn_FontName(sFontName);
withBlock1.Size = sngFontSize;
// .Color =
withBlock1.ColorIndex = iFontColourIdx;
withBlock1.Background = zReturn_Background(sFontBackground);
withBlock1.Bold = bBold;
withBlock1.Italic = bItalic;
withBlock1.Shadow = bShadow;
withBlock1.Underline = zReturn_UnderlineStyle(sUnderline);
withBlock1.Strikethrough = bStrikethrough;
withBlock1.Subscript = bSubscript;
withBlock1.Superscript = bSuperscript;
}

withBlock.Border.Color = iBorderColour;
withBlock.Border.Weight = zReturn_BorderWeight(iBorderWeight);
withBlock.Border.LineStyle = zReturn_LineStyle(sBorderLineStyle);

// chart area has a shadow property
withBlock.Shadow = bShadow;

if ((sInteriorPatternStyle == "NO") & (sGradientColourType == "0") & (sTexturePresetType == "NO"))
{
withBlock.Fill.Solid();
withBlock.Interior.ColorIndex = iInteriorColourIdx;
}

if ((sInteriorPatternStyle != "NO"))
withBlock.Interior.Pattern = zReturn_Pattern(sInteriorPatternStyle);

if ((sGradientColourType == "1"))
{
// doesn't seem to work ?
// .Fill.ForeColor.RGB = RGB(120, 120, 120)

withBlock.Fill.ForeColor.SchemeColor = iFillForeColour;
withBlock.Fill.OneColorGradient(Style: zReturn_GradientStyle(sGradientStyle), Variant: iGradientVariant, Degree: sngGradientDegree);
}

if ((sGradientColourType == "2") | ((sInteriorPatternStyle != "NO") & (sGradientColourType == "0")))
{
withBlock.Fill.ForeColor.SchemeColor = iFillForeColour;
withBlock.Fill.BackColor.SchemeColor = iFillBackColour;
withBlock.Fill.TwoColorGradient(Style: zReturn_GradientStyle(sGradientStyle), Variant: iGradientVariant);
}

if (sGradientColourType == "P")
withBlock.Fill.PresetGradient(Style: zReturn_GradientStyle(sGradientStyle), Variant: iGradientVariant, PresetGradientType: zReturn_PresetGradientType(sGradientPresetType));

if (sTexturePresetType != "NO")
withBlock.Fill.PresetTextured(PresetTexture: zReturn_PresetTextureType(sTexturePresetType));

if (sFillPatternStyle != "NO")
withBlock.Fill.Patterned(Pattern: zReturn_PatternType(sFillPatternStyle));
}
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objChart = null/* TODO Change to default(_) if this is not a reference type */;
objChartArea = null/* TODO Change to default(_) if this is not a reference type */;
objFont = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartFormat_ChartArea", msMODULENAME, "format the chart area on the active chart.", gobjCOMException, gobjException);
}
}
Public Sub ChartFormat_ChartArea(ByVal objChart As Excel.Chart, _
Optional ByVal sFontName As String = "AR", _
Optional ByVal sngFontSize As Single = 10, _
Optional ByVal iFontColourIdx As Integer = 1, _
Optional ByVal sFontBackground As String = "AU", _
Optional ByVal bBold As Boolean = False, _
Optional ByVal bItalic As Boolean = False, _
Optional ByVal sUnderline As String = "NO", _
Optional ByVal bStrikethrough As Boolean = False, _
Optional ByVal bSubscript As Boolean = False, _
Optional ByVal bSuperscript As Boolean = False, _
Optional ByVal iBorderColour As Integer = 0, _
Optional ByVal iBorderWeight As Integer = 1, _
Optional ByVal sBorderLineStyle As String = "NO", _
Optional ByVal bShadow As Boolean = False, _
Optional ByVal iInteriorColourIdx As Integer = 2, _
Optional ByVal sInteriorPatternStyle As String = "NO", _
Optional ByVal iFillForeColour As Integer = 1, _
Optional ByVal iFillBackColour As Integer = 1, _
Optional ByVal bFillAsSolid As Boolean = True, _
Optional ByVal sGradientColourType As String = "0", _
Optional ByVal sGradientStyle As String = "HR", _
Optional ByVal iGradientVariant As Integer = 0, _
Optional ByVal sngGradientDegree As Single = 0.5, _
Optional ByVal sGradientPresetType As String = "", _
Optional ByVal sTexturePresetType As String = "NO", _
Optional ByVal sFillPatternStyle As String = "NO")

Dim objChartArea As Excel.ChartArea
Dim objFont As Excel.Font

Try
If clsError.ErrorFlag() = True Then Exit Sub

objChartArea = objChart.ChartArea

With objChartArea
.AutoScaleFont = False 'prevents the Not Enough Memory error

objFont = .Font
With objFont
.Name = zReturn_FontName(sFontName)
.Size = sngFontSize
'.Color =
.ColorIndex = iFontColourIdx
.Background = zReturn_Background(sFontBackground)
.Bold = bBold
.Italic = bItalic
.Shadow = bShadow
.Underline = zReturn_UnderlineStyle(sUnderline)
.Strikethrough = bStrikethrough
.Subscript = bSubscript
.Superscript = bSuperscript

'.OutlineFont = False Not used on Windows
End With

.Border.Color = iBorderColour
.Border.Weight = zReturn_BorderWeight(iBorderWeight)
.Border.LineStyle = zReturn_LineStyle(sBorderLineStyle)

'chart area has a shadow property
.Shadow = bShadow

If (sInteriorPatternStyle = "NO") And _
(sGradientColourType = "0") And (sTexturePresetType = "NO") Then
.Fill.Solid()
.Interior.ColorIndex = iInteriorColourIdx
End If

If (sInteriorPatternStyle <> "NO") Then
.Interior.Pattern = zReturn_Pattern(sInteriorPatternStyle)
End If

If (sGradientColourType = "1") Then
'doesn't seem to work ?
'.Fill.ForeColor.RGB = RGB(120, 120, 120)

.Fill.ForeColor.SchemeColor = iFillForeColour
.Fill.OneColorGradient(Style:=zReturn_GradientStyle(sGradientStyle), _
Variant:=iGradientVariant, _
Degree:=sngGradientDegree)
End If

If (sGradientColourType = "2") Or _
((sInteriorPatternStyle <> "NO") And (sGradientColourType = "0")) Then
.Fill.ForeColor.SchemeColor = iFillForeColour
.Fill.BackColor.SchemeColor = iFillBackColour
.Fill.TwoColorGradient(Style:=zReturn_GradientStyle(sGradientStyle), _
Variant:=iGradientVariant)
End If

If sGradientColourType = "P" Then
.Fill.PresetGradient(Style:=zReturn_GradientStyle(sGradientStyle), _
Variant:=iGradientVariant, _
PresetGradientType:= _
zReturn_PresetGradientType(sGradientPresetType))
End If

If sTexturePresetType <> "NO" Then
.Fill.PresetTextured(PresetTexture:= _
zReturn_PresetTextureType(sTexturePresetType))
End If

If sFillPatternStyle <> "NO" Then
.Fill.Patterned(Pattern:=zReturn_PatternType(sFillPatternStyle))
End If
End With

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objChart = Nothing
objChartArea = Nothing
objFont = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartFormat_ChartArea", msMODULENAME, _
"format the chart area on the active chart.", _
gobjCOMException, gobjException)
End If
End Try
End Sub

ChartFormat_DataTableSizePosition

public void ChartFormat_DataTableSizePosition(Excel.Chart objChart, float sngFontSize = 10)
{
try
{
if (clsError.ErrorFlag() == true)
return;

{
var withBlock = objChart;
// -----------------
if (withBlock.HasDataTable == true)
{
}
}

// ensure fonts are correct after re-sizing
objChart.ChartArea.Font.Size = sngFontSize;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objChart = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("Chart_DataTableSizePosition", msMODULENAME, "adjust the size and position of the data table.", gobjCOMException, gobjException);
}
}
Public Sub ChartFormat_DataTableSizePosition(ByVal objChart As Excel.Chart, _
Optional ByVal sngFontSize As Single = 10)

Try
If clsError.ErrorFlag() = True Then Exit Sub

With objChart
'-----------------
If .HasDataTable = True Then
'' .DataTable = bHasADataTable

End If
' .DataTable.Delete
End With

'ensure fonts are correct after re-sizing
objChart.ChartArea.Font.Size = sngFontSize

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objChart = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("Chart_DataTableSizePosition", msMODULENAME, _
"adjust the size and position of the data table.", _
gobjCOMException, gobjException)
End If
End Try
End Sub

ChartFormat_Legend

public void ChartFormat_Legend(Excel.Chart objChart, string sFontName = "AR", float sngFontSize = 10, int iFontColourIdx = 1, string sFontBackground = "AU", bool bBold = false, bool bItalic = false, bool bUnderLine = false, bool bStrikethrough = false, bool bSubscript = false, bool bSuperscript = false, int iBorderColour = 1, int iBorderWeight = 1, string sBorderLineStyle = "NO", bool bShadow = false, int iInteriorColourIdx = 2, string sInteriorPatternStyle = "NO", int iFillForeColour = 0, int iFillBackColour = 0, bool bFillAsSolid = true, string sGradientColourType = "0", string sGradientStyle = "HR", int iGradientVariant = 1, float sngGradientDegree = 0.5, string sGradientPresetType = "", string sTexturePresetType = "NO", string sFillPatternStyle = "NO")
{
try
{
if (clsError.ErrorFlag() == true)
return;

if (objChart.HasLegend == true)
{
{
var withBlock = objChart.Legend;
{
var withBlock1 = withBlock.Font;
withBlock1.Name = zReturn_FontName(sFontName);
withBlock1.Size = sngFontSize;
// .Color
withBlock1.ColorIndex = iFontColourIdx;
withBlock1.Background = zReturn_Background(sFontBackground);
withBlock1.Bold = bBold;
withBlock1.Italic = bItalic;
withBlock1.Shadow = bShadow;
withBlock1.Underline = bUnderLine;
withBlock1.Strikethrough = bStrikethrough;
withBlock1.Subscript = bSubscript;
withBlock1.Superscript = bSuperscript;
}

withBlock.Border.Color = iBorderColour;
withBlock.Border.Weight = zReturn_BorderWeight(iBorderWeight);
withBlock.Border.LineStyle = zReturn_LineStyle(sBorderLineStyle);

withBlock.Shadow = bShadow;

if ((sTexturePresetType == "NO") & (sGradientColourType == "0") & (sInteriorPatternStyle == "NO"))
{
withBlock.Fill.Solid();
withBlock.Interior.ColorIndex = iInteriorColourIdx;
}

if ((sInteriorPatternStyle != "NO"))
withBlock.Interior.Pattern = zReturn_Pattern(sInteriorPatternStyle);

if ((sGradientColourType == "1"))
withBlock.Fill.ForeColor.SchemeColor = iFillForeColour;

if ((sGradientColourType == "2") | ((sInteriorPatternStyle != "NO") & (sGradientColourType == "0")))
{
withBlock.Fill.ForeColor.SchemeColor = iFillForeColour;
withBlock.Fill.BackColor.SchemeColor = iFillBackColour;
}

if (sGradientColourType == "1")
withBlock.Fill.OneColorGradient(Style: zReturn_GradientStyle(sGradientStyle), Variant: iGradientVariant, Degree: sngGradientDegree);

if (sGradientColourType == "2")
withBlock.Fill.TwoColorGradient(Style: zReturn_GradientStyle(sGradientStyle), Variant: iGradientVariant);

if (sGradientColourType == "P")
withBlock.Fill.PresetGradient(Style: zReturn_GradientStyle(sGradientStyle), Variant: iGradientVariant, PresetGradientType: zReturn_PresetGradientType(sGradientPresetType));

if (sTexturePresetType != "NO")
withBlock.Fill.PresetTextured(PresetTexture: zReturn_PresetTextureType(sTexturePresetType));

if (sFillPatternStyle != "NO")
withBlock.Fill.Patterned(Pattern: zReturn_PatternType(sFillPatternStyle));
}
}
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objChart = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("Chart_LegendFormat", msMODULENAME, "format the legend on the active chart.", gobjCOMException, gobjException);
}
}
Public Sub ChartFormat_Legend(ByVal objChart As Excel.Chart, _
Optional ByVal sFontName As String = "AR", _
Optional ByVal sngFontSize As Single = 10, _
Optional ByVal iFontColourIdx As Integer = 1, _
Optional ByVal sFontBackground As String = "AU", _
Optional ByVal bBold As Boolean = False, _
Optional ByVal bItalic As Boolean = False, _
Optional ByVal bUnderLine As Boolean = False, _
Optional ByVal bStrikethrough As Boolean = False, _
Optional ByVal bSubscript As Boolean = False, _
Optional ByVal bSuperscript As Boolean = False, _
Optional ByVal iBorderColour As Integer = 1, _
Optional ByVal iBorderWeight As Integer = 1, _
Optional ByVal sBorderLineStyle As String = "NO", _
Optional ByVal bShadow As Boolean = False, _
Optional ByVal iInteriorColourIdx As Integer = 2, _
Optional ByVal sInteriorPatternStyle As String = "NO", _
Optional ByVal iFillForeColour As Integer = 0, _
Optional ByVal iFillBackColour As Integer = 0, _
Optional ByVal bFillAsSolid As Boolean = True, _
Optional ByVal sGradientColourType As String = "0", _
Optional ByVal sGradientStyle As String = "HR", _
Optional ByVal iGradientVariant As Integer = 1, _
Optional ByVal sngGradientDegree As Single = 0.5, _
Optional ByVal sGradientPresetType As String = "", _
Optional ByVal sTexturePresetType As String = "NO", _
Optional ByVal sFillPatternStyle As String = "NO")

Try
If clsError.ErrorFlag() = True Then Exit Sub

If objChart.HasLegend = True Then
With objChart.Legend
With .Font
.Name = zReturn_FontName(sFontName)
.Size = sngFontSize
'.Color
.ColorIndex = iFontColourIdx
.Background = zReturn_Background(sFontBackground)
.Bold = bBold
.Italic = bItalic
.Shadow = bShadow
.Underline = bUnderLine
.Strikethrough = bStrikethrough
.Subscript = bSubscript
.Superscript = bSuperscript
End With

.Border.Color = iBorderColour
.Border.Weight = zReturn_BorderWeight(iBorderWeight)
.Border.LineStyle = zReturn_LineStyle(sBorderLineStyle)

.Shadow = bShadow

If (sTexturePresetType = "NO") And _
(sGradientColourType = "0") And (sInteriorPatternStyle = "NO") Then
.Fill.Solid()
.Interior.ColorIndex = iInteriorColourIdx
End If

If (sInteriorPatternStyle <> "NO") Then
.Interior.Pattern = zReturn_Pattern(sInteriorPatternStyle)
End If

If (sGradientColourType = "1") Then
.Fill.ForeColor.SchemeColor = iFillForeColour
End If

If (sGradientColourType = "2") Or _
((sInteriorPatternStyle <> "NO") And (sGradientColourType = "0")) Then
.Fill.ForeColor.SchemeColor = iFillForeColour
.Fill.BackColor.SchemeColor = iFillBackColour
End If

If sGradientColourType = "1" Then
.Fill.OneColorGradient(Style:=zReturn_GradientStyle(sGradientStyle), _
Variant:=iGradientVariant, _
Degree:=sngGradientDegree)
End If

If sGradientColourType = "2" Then
.Fill.TwoColorGradient(Style:=zReturn_GradientStyle(sGradientStyle), _
Variant:=iGradientVariant)
End If

If sGradientColourType = "P" Then
.Fill.PresetGradient(Style:=zReturn_GradientStyle(sGradientStyle), _
Variant:=iGradientVariant, _
PresetGradientType:= _
zReturn_PresetGradientType(sGradientPresetType))
End If

If sTexturePresetType <> "NO" Then
.Fill.PresetTextured(PresetTexture:= _
zReturn_PresetTextureType(sTexturePresetType))
End If

If sFillPatternStyle <> "NO" Then
.Fill.Patterned(Pattern:=zReturn_PatternType(sFillPatternStyle))
End If
End With
End If

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objChart = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("Chart_LegendFormat", msMODULENAME, _
"format the legend on the active chart.", _
gobjCOMException, gobjException)
End If
End Try
End Sub

ChartFormat_LegendSizePosition

public void ChartFormat_LegendSizePosition(Excel.Chart objChart, string sLegendPositionKey = "BT", float sngFontSize = 10)
{
try
{
if (clsError.ErrorFlag() == true)
return;

{
var withBlock = objChart;
// ------------------
if ((withBlock.HasLegend == true))
{
withBlock.Legend.Position = zReturn_LegendPosition(sLegendPositionKey);
withBlock.PlotArea.Height = withBlock.ChartArea.Height;

if (sLegendPositionKey == "BT")
{
// if the legend is at the bottom then move plot area up
withBlock.PlotArea.Height = withBlock.PlotArea.Height - withBlock.Legend.Height;

withBlock.Legend.Left = withBlock.ChartArea.Left;
withBlock.Legend.Width = withBlock.ChartArea.Width;
}

if (sLegendPositionKey == "RI")
{
// if the legend is at the bottom then move plot area up
withBlock.PlotArea.Height = withBlock.PlotArea.Height - withBlock.Legend.Height;

withBlock.Legend.Left = withBlock.ChartArea.Left + withBlock.ChartArea.Width;
// the minus 1 is needed as is chopps of the bottom of the legend otherwise
withBlock.Legend.Height = (withBlock.ChartArea.Height - 6);
}
}
}

// ensure fonts are correct after re-sizing
objChart.ChartArea.Font.Size = sngFontSize;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("Chart_LegendSizePosition", msMODULENAME, "adjust the size and position of the legend.", gobjCOMException, gobjException);
}
}
Public Sub ChartFormat_LegendSizePosition(ByVal objChart As Excel.Chart, _
Optional ByVal sLegendPositionKey As String = "BT", _
Optional ByVal sngFontSize As Single = 10)

Try
If clsError.ErrorFlag() = True Then Exit Sub

With objChart
'------------------
If (.HasLegend = True) Then
.Legend.Position = zReturn_LegendPosition(sLegendPositionKey)
.PlotArea.Height = .ChartArea.Height

If sLegendPositionKey = "BT" Then
'if the legend is at the bottom then move plot area up
.PlotArea.Height = .PlotArea.Height - .Legend.Height

.Legend.Left = .ChartArea.Left
.Legend.Width = .ChartArea.Width
End If

If sLegendPositionKey = "RI" Then
'if the legend is at the bottom then move plot area up
.PlotArea.Height = .PlotArea.Height - .Legend.Height

.Legend.Left = .ChartArea.Left + .ChartArea.Width
'the minus 1 is needed as is chopps of the bottom of the legend otherwise
.Legend.Height = (.ChartArea.Height - 6)
End If

End If
End With

'ensure fonts are correct after re-sizing
objChart.ChartArea.Font.Size = sngFontSize

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("Chart_LegendSizePosition", msMODULENAME, _
"adjust the size and position of the legend.", _
gobjCOMException, gobjException)
End If
End Try
End Sub

ChartFormat_PlotArea

public void ChartFormat_PlotArea(Excel.Chart objChart, int iBorderColour = 0, int iBorderWeight = 1, string sBorderLineStyle = "NO", int iInteriorColourIdx = 2, string sInteriorPatternStyle = "NO", int iFillForeColour = 0, int iFillBackColour = 0, bool bFillAsSolid = true, string sGradientColourType = "0", string sGradientStyle = "HR", int iGradientVariant = 1, float sngGradientDegree = 0.5, string sGradientPresetType = "", string sTexturePresetType = "NO", string sFillPatternStyle = "NO")
{
try
{
if (clsError.ErrorFlag() == true)
return;

{
var withBlock = objChart.PlotArea;
withBlock.Border.Color = iBorderColour;
withBlock.Border.Weight = zReturn_BorderWeight(iBorderWeight);
withBlock.Border.LineStyle = zReturn_LineStyle(sBorderLineStyle);

// ---------------- plot area doesn't have a shadow !!

if ((sTexturePresetType == "NO") & (sGradientColourType == "0") & (sInteriorPatternStyle == "NO"))
{
withBlock.Fill.Solid();
withBlock.Interior.ColorIndex = iInteriorColourIdx;
}

if ((sInteriorPatternStyle != "NO"))
withBlock.Interior.Pattern = zReturn_Pattern(sInteriorPatternStyle);

if ((sGradientColourType == "1"))
withBlock.Fill.ForeColor.SchemeColor = iFillForeColour;

if ((sGradientColourType == "2") | ((sInteriorPatternStyle != "NO") & (sGradientColourType == "0")))
{
withBlock.Fill.ForeColor.SchemeColor = iFillForeColour;
withBlock.Fill.BackColor.SchemeColor = iFillBackColour;
}

if (sGradientColourType == "1")
withBlock.Fill.OneColorGradient(Style: zReturn_GradientStyle(sGradientStyle), Variant: iGradientVariant, Degree: sngGradientDegree);

if (sGradientColourType == "2")
withBlock.Fill.TwoColorGradient(Style: zReturn_GradientStyle(sGradientStyle), Variant: iGradientVariant);

if (sGradientColourType == "P")
withBlock.Fill.PresetGradient(Style: zReturn_GradientStyle(sGradientStyle), Variant: iGradientVariant, PresetGradientType: zReturn_PresetGradientType(sGradientPresetType));

if (sTexturePresetType != "NO")
withBlock.Fill.PresetTextured(PresetTexture: zReturn_PresetTextureType(sTexturePresetType));

if (sFillPatternStyle != "NO")
withBlock.Fill.Patterned(Pattern: zReturn_PatternType(sFillPatternStyle));
}
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objChart = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("Chart_PlotAreaFormat", msMODULENAME, "format the plot area on the active chart.", gobjCOMException, gobjException);
}
}
Public Sub ChartFormat_PlotArea(ByVal objChart As Excel.Chart, _
Optional ByVal iBorderColour As Integer = 0, _
Optional ByVal iBorderWeight As Integer = 1, _
Optional ByVal sBorderLineStyle As String = "NO", _
Optional ByVal iInteriorColourIdx As Integer = 2, _
Optional ByVal sInteriorPatternStyle As String = "NO", _
Optional ByVal iFillForeColour As Integer = 0, _
Optional ByVal iFillBackColour As Integer = 0, _
Optional ByVal bFillAsSolid As Boolean = True, _
Optional ByVal sGradientColourType As String = "0", _
Optional ByVal sGradientStyle As String = "HR", _
Optional ByVal iGradientVariant As Integer = 1, _
Optional ByVal sngGradientDegree As Single = 0.5, _
Optional ByVal sGradientPresetType As String = "", _
Optional ByVal sTexturePresetType As String = "NO", _
Optional ByVal sFillPatternStyle As String = "NO")


Try
If clsError.ErrorFlag() = True Then Exit Sub

With objChart.PlotArea

.Border.Color = iBorderColour
.Border.Weight = zReturn_BorderWeight(iBorderWeight)
.Border.LineStyle = zReturn_LineStyle(sBorderLineStyle)

' ---------------- plot area doesn't have a shadow !!

If (sTexturePresetType = "NO") And _
(sGradientColourType = "0") And (sInteriorPatternStyle = "NO") Then
.Fill.Solid()
.Interior.ColorIndex = iInteriorColourIdx
End If

If (sInteriorPatternStyle <> "NO") Then
.Interior.Pattern = zReturn_Pattern(sInteriorPatternStyle)
End If

If (sGradientColourType = "1") Then
.Fill.ForeColor.SchemeColor = iFillForeColour
End If

If (sGradientColourType = "2") Or _
((sInteriorPatternStyle <> "NO") And (sGradientColourType = "0")) Then
.Fill.ForeColor.SchemeColor = iFillForeColour
.Fill.BackColor.SchemeColor = iFillBackColour
End If

If sGradientColourType = "1" Then
.Fill.OneColorGradient(Style:=zReturn_GradientStyle(sGradientStyle), _
Variant:=iGradientVariant, _
Degree:=sngGradientDegree)
End If

If sGradientColourType = "2" Then
.Fill.TwoColorGradient(Style:=zReturn_GradientStyle(sGradientStyle), _
Variant:=iGradientVariant)
End If

If sGradientColourType = "P" Then
.Fill.PresetGradient(Style:=zReturn_GradientStyle(sGradientStyle), _
Variant:=iGradientVariant, _
PresetGradientType:= _
zReturn_PresetGradientType(sGradientPresetType))
End If

If sTexturePresetType <> "NO" Then
.Fill.PresetTextured(PresetTexture:= _
zReturn_PresetTextureType(sTexturePresetType))
End If

If sFillPatternStyle <> "NO" Then
.Fill.Patterned(Pattern:=zReturn_PatternType(sFillPatternStyle))
End If
End With

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objChart = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("Chart_PlotAreaFormat", msMODULENAME, _
"format the plot area on the active chart.", _
gobjCOMException, gobjException)
End If
End Try
End Sub

ChartFormat_PlotAreaSizeMove

public void ChartFormat_PlotAreaSizeMove(Excel.Chart objChart, double dbWidth, int iFromLeft, double dbHeight, int iFromTop, string sChartName = "", string sWshName = "")
{
Excel.PlotArea objPlotArea;

try
{
if (clsError.ErrorFlag() == true)
return;

// maybe split in 2 separate procedures

objPlotArea = objChart.PlotArea;

{
var withBlock = objPlotArea // all these widths are in points !!
;
withBlock.Left = iFromLeft;
withBlock.Width = dbWidth; // Application.UsableWidth ???
withBlock.Top = iFromTop;
withBlock.Height = dbHeight; // Application.UsableHeight ???
}
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objChart = null/* TODO Change to default(_) if this is not a reference type */;
objPlotArea = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("Chart_PlotAreaSizeMove", msMODULENAME, "adjust the size and positioning of the plot area on the active chart.", gobjCOMException, gobjException);
}
}
Public Sub ChartFormat_PlotAreaSizeMove(ByVal objChart As Excel.Chart, _
ByVal dbWidth As Double, _
ByVal iFromLeft As Integer, _
ByVal dbHeight As Double, _
ByVal iFromTop As Integer, _
Optional ByVal sChartName As String = "", _
Optional ByVal sWshName As String = "")

Dim objPlotArea As Excel.PlotArea

Try
If clsError.ErrorFlag() = True Then Exit Sub

'maybe split in 2 separate procedures

objPlotArea = objChart.PlotArea

With objPlotArea 'all these widths are in points !!
.Left = iFromLeft
.Width = dbWidth 'Application.UsableWidth ???
.Top = iFromTop
.Height = dbHeight 'Application.UsableHeight ???
End With

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objChart = Nothing
objPlotArea = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("Chart_PlotAreaSizeMove", msMODULENAME, _
"adjust the size and positioning of the plot area on the active chart.", _
gobjCOMException, gobjException)
End If
End Try
End Sub

ChartFormat_SeriesArea

public void ChartFormat_SeriesArea(Excel.Chart objChart, Excel.Series objSeries, int iSeriesNo, string sSeriesName = "", int iBorderColour = 0, int iBorderWeight = 1, string sBorderLineStyle = "NO", int iInteriorColourIdx = 0, string sInteriorPatternStyle = "NO", int iFillForeColour = 0, int iFillBackColour = 0, bool bFillAsSolid = true, string sGradientColourType = "0", string sGradientStyle = "HR", int iGradientVariant = 1, float sngGradientDegree = 0.5, string sGradientPresetType = "", string sTexturePresetType = "NO", string sFillPatternStyle = "NO")
{
try
{
if (clsError.ErrorFlag() == true)
return;

if (sSeriesName != "")
objSeries.Name = sSeriesName;

{
var withBlock = objSeries;
withBlock.Border.Color = iBorderColour;
withBlock.Border.Weight = zReturn_BorderWeight(iBorderWeight);
withBlock.Border.LineStyle = zReturn_LineStyle(sBorderLineStyle);

if ((sTexturePresetType == "NO") & (sGradientColourType == "0") & (sInteriorPatternStyle == "NO"))
{
withBlock.Fill.Solid();

if (iInteriorColourIdx == 0)
{
withBlock.Interior.ColorIndex = Colour_AreaReturn(iSeriesNo);
withBlock.Interior.Pattern = Excel.XlPattern.xlPatternSolid;
}

if (iInteriorColourIdx > 0)
{
withBlock.Interior.ColorIndex = iInteriorColourIdx;
withBlock.Interior.Pattern = Excel.XlPattern.xlPatternSolid;
}
}

if ((sInteriorPatternStyle != "NO"))
withBlock.Interior.Pattern = zReturn_Pattern(sInteriorPatternStyle);

if ((sGradientColourType == "1"))
{
if (iFillForeColour == 0)
withBlock.Fill.ForeColor.SchemeColor = 16 + iSeriesNo;
if (iFillForeColour != 0)
withBlock.Fill.ForeColor.SchemeColor = 16 + iSeriesNo;
}

if ((sGradientColourType == "2") | ((sInteriorPatternStyle != "NO") & (sGradientColourType == "0")))
{
if (iFillForeColour == 0)
withBlock.Fill.ForeColor.SchemeColor = 16 + iSeriesNo;
if (iFillForeColour != 0)
withBlock.Fill.ForeColor.SchemeColor = 16 + iSeriesNo;
withBlock.Fill.BackColor.SchemeColor = 16 + iSeriesNo;
}

if (sGradientColourType == "1")
withBlock.Fill.OneColorGradient(Style: zReturn_GradientStyle(sGradientStyle), Variant: iGradientVariant, Degree: sngGradientDegree);

if (sGradientColourType == "2")
withBlock.Fill.TwoColorGradient(Style: zReturn_GradientStyle(sGradientStyle), Variant: iGradientVariant);

if (sGradientColourType == "P")
withBlock.Fill.PresetGradient(Style: zReturn_GradientStyle(sGradientStyle), Variant: iGradientVariant, PresetGradientType: zReturn_PresetGradientType(sGradientPresetType));

if (sTexturePresetType != "NO")
withBlock.Fill.PresetTextured(PresetTexture: zReturn_PresetTextureType(sTexturePresetType));

if (sFillPatternStyle != "NO")
withBlock.Fill.Patterned(Pattern: zReturn_PatternType(sFillPatternStyle));
}

if (ChartType_SeriesTypeIsIt3D(objSeries) == true)
Chart_SeriesFormat3D(objChart, objSeries, iSeriesNo);
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objChart = null/* TODO Change to default(_) if this is not a reference type */;
objSeries = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("Chart_SeriesAreaFormat", msMODULENAME, "format the 'Area' of the chart.", gobjCOMException, gobjException);
}
}
Public Sub ChartFormat_SeriesArea(ByVal objChart As Excel.Chart, _
ByVal objSeries As Excel.Series, _
ByVal iSeriesNo As Integer, _
Optional ByVal sSeriesName As String = "", _
Optional ByVal iBorderColour As Integer = 0, _
Optional ByVal iBorderWeight As Integer = 1, _
Optional ByVal sBorderLineStyle As String = "NO", _
Optional ByVal iInteriorColourIdx As Integer = 0, _
Optional ByVal sInteriorPatternStyle As String = "NO", _
Optional ByVal iFillForeColour As Integer = 0, _
Optional ByVal iFillBackColour As Integer = 0, _
Optional ByVal bFillAsSolid As Boolean = True, _
Optional ByVal sGradientColourType As String = "0", _
Optional ByVal sGradientStyle As String = "HR", _
Optional ByVal iGradientVariant As Integer = 1, _
Optional ByVal sngGradientDegree As Single = 0.5, _
Optional ByVal sGradientPresetType As String = "", _
Optional ByVal sTexturePresetType As String = "NO", _
Optional ByVal sFillPatternStyle As String = "NO")

Try
If clsError.ErrorFlag() = True Then Exit Sub

If sSeriesName <> "" Then objSeries.Name = sSeriesName

With objSeries
.Border.Color = iBorderColour
.Border.Weight = zReturn_BorderWeight(iBorderWeight)
.Border.LineStyle = zReturn_LineStyle(sBorderLineStyle)

If (sTexturePresetType = "NO") And _
(sGradientColourType = "0") And _
(sInteriorPatternStyle = "NO") Then

.Fill.Solid()

If iInteriorColourIdx = 0 Then
.Interior.ColorIndex = Colour_AreaReturn(iSeriesNo)
.Interior.Pattern = Excel.XlPattern.xlPatternSolid
End If

If iInteriorColourIdx > 0 Then
.Interior.ColorIndex = iInteriorColourIdx
.Interior.Pattern = Excel.XlPattern.xlPatternSolid
End If
End If

If (sInteriorPatternStyle <> "NO") Then
.Interior.Pattern = zReturn_Pattern(sInteriorPatternStyle)
End If

If (sGradientColourType = "1") Then
If iFillForeColour = 0 Then .Fill.ForeColor.SchemeColor = 16 + iSeriesNo
If iFillForeColour <> 0 Then .Fill.ForeColor.SchemeColor = 16 + iSeriesNo
End If

If (sGradientColourType = "2") Or _
((sInteriorPatternStyle <> "NO") And (sGradientColourType = "0")) Then
If iFillForeColour = 0 Then .Fill.ForeColor.SchemeColor = 16 + iSeriesNo
If iFillForeColour <> 0 Then .Fill.ForeColor.SchemeColor = 16 + iSeriesNo
.Fill.BackColor.SchemeColor = 16 + iSeriesNo
End If

If sGradientColourType = "1" Then
.Fill.OneColorGradient(Style:=zReturn_GradientStyle(sGradientStyle), _
Variant:=iGradientVariant, _
Degree:=sngGradientDegree)
End If

If sGradientColourType = "2" Then
.Fill.TwoColorGradient(Style:=zReturn_GradientStyle(sGradientStyle), _
Variant:=iGradientVariant)
End If

If sGradientColourType = "P" Then
.Fill.PresetGradient(Style:=zReturn_GradientStyle(sGradientStyle), _
Variant:=iGradientVariant, _
PresetGradientType:= _
zReturn_PresetGradientType(sGradientPresetType))
End If

If sTexturePresetType <> "NO" Then
.Fill.PresetTextured(PresetTexture:= _
zReturn_PresetTextureType(sTexturePresetType))
End If

If sFillPatternStyle <> "NO" Then
.Fill.Patterned(Pattern:=zReturn_PatternType(sFillPatternStyle))
End If
End With

If ChartType_SeriesTypeIsIt3D(objSeries) = True Then
Call Chart_SeriesFormat3D(objChart, objSeries, iSeriesNo)
End If

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objChart = Nothing
objSeries = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("Chart_SeriesAreaFormat", msMODULENAME, _
"format the 'Area' of the chart.", _
gobjCOMException, gobjException)
End If
End Try
End Sub

ChartFormat_SeriesLine

public void ChartFormat_SeriesLine(Excel.Chart objChart, Excel.Series objSeries, int iSeriesNo, string sSeriesName = "")
{
try
{
if (clsError.ErrorFlag() == true)
return;


if (sSeriesName != "")
objSeries.Name = sSeriesName;

{
var withBlock = objSeries;
}
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objChart = null/* TODO Change to default(_) if this is not a reference type */;
objSeries = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("Chart_SeriesLineFormat", msMODULENAME, "format the 'Line' of the chart.", gobjCOMException, gobjException);
}
}
Public Sub ChartFormat_SeriesLine(ByVal objChart As Excel.Chart, _
ByVal objSeries As Excel.Series, _
ByVal iSeriesNo As Integer, _
Optional ByVal sSeriesName As String = "")

Try
If clsError.ErrorFlag() = True Then Exit Sub


If sSeriesName <> "" Then objSeries.Name = sSeriesName

With objSeries


End With

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objChart = Nothing
objSeries = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("Chart_SeriesLineFormat", msMODULENAME, _
"format the 'Line' of the chart.", _
gobjCOMException, gobjException)
End If
End Try
End Sub

ChartFormat_TitleSizePosition

public void ChartFormat_TitleSizePosition(Excel.Chart objChart, string sLegendPositionKey = "BT", float sngFontSize = 10)
{
Excel.ChartArea objChartArea;

try
{
if (clsError.ErrorFlag() == true)
return;

objChartArea = objChart.ChartArea;

{
var withBlock = objChart;
// ------------------
if ((withBlock.HasTitle == true))
{
withBlock.ChartTitle.Top = 1; // if there is a title put it at the top
withBlock.ChartTitle.Left = (objChartArea.Width - (Len(withBlock.ChartTitle.Characters.Text) * 3)) / (double)2;

// .ChartTitle.Left = in the middle - needs to be in the middle ???????

withBlock.PlotArea.Height = withBlock.PlotArea.Height - giDEF_TITLESPACE;
// height + top must always be the same !!
withBlock.PlotArea.Top = withBlock.PlotArea.Top + giDEF_TITLESPACE;
}
}

objChartArea.Font.Size = sngFontSize; // ensure fonts are correct after re-sizing
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objChart = null/* TODO Change to default(_) if this is not a reference type */;
objChartArea = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("Chart_TitleSizePosition", msMODULENAME, "adjust the size and position of the title.", gobjCOMException, gobjException);
}
}
Public Sub ChartFormat_TitleSizePosition(ByVal objChart As Excel.Chart, _
Optional ByVal sLegendPositionKey As String = "BT", _
Optional ByVal sngFontSize As Single = 10)

Dim objChartArea As Excel.ChartArea

Try
If clsError.ErrorFlag() = True Then Exit Sub

objChartArea = objChart.ChartArea

With objChart
'------------------
If (.HasTitle = True) Then
.ChartTitle.Top = 1 'if there is a title put it at the top
.ChartTitle.Left = (objChartArea.Width - _
(Len(.ChartTitle.Characters.Text) * 3)) / 2

' .ChartTitle.Left = in the middle - needs to be in the middle ???????

.PlotArea.Height = .PlotArea.Height - giDEF_TITLESPACE
'height + top must always be the same !!
.PlotArea.Top = .PlotArea.Top + giDEF_TITLESPACE
End If
End With

objChartArea.Font.Size = sngFontSize 'ensure fonts are correct after re-sizing

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objChart = Nothing
objChartArea = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("Chart_TitleSizePosition", msMODULENAME, _
"adjust the size and position of the title.", _
gobjCOMException, gobjException)
End If
End Try
End Sub

ChartHas_Legend

public static bool ChartHas_Legend(Excel.Chart objChart)
{
try
{
// an error occurs then there is no plot area
if (objChart.Legend.Border.Color == 0)
ChartHasLegend = true;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
ChartHasLegend = false;
}
}
Public Shared Function ChartHas_Legend(ByVal objChart As Excel.Chart) As Boolean
Try
'an error occurs then there is no plot area
If objChart.Legend.Border.Color = 0 Then
ChartHasLegend = True
End If

Catch objCOMException As System.Runtime.InteropServices.COMException
ChartHasLegend = False
End Try
End Function

ChartHas_PlotArea

public static bool ChartHas_PlotArea(Excel.Chart objChart)
{
try
{
// an error occurs then there is no plot area
if (objChart.PlotArea.Border.Color == 0)
{
}
ChartHas_PlotArea = true;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
ChartHasPlotArea = false;
}
}
Public Shared Function ChartHas_PlotArea(ByVal objChart As Excel.Chart) As Boolean
Try
'an error occurs then there is no plot area
If objChart.PlotArea.Border.Color = 0 Then
End If
ChartHas_PlotArea = True

Catch objCOMException As System.Runtime.InteropServices.COMException
ChartHasPlotArea = False
End Try
End Function

ChartHas_SeriesCollection

public static bool ChartHas_SeriesCollection(Excel.SeriesCollection objSeriesColl, System.Int32 iSeriesNo)
{
try
{
// an error occurs when the series number is valid but not plotted - eg Pie Charts
Excel.Series objSeries;

objSeries = objSeriesColl.Item(iSeriesNo);

ChartSeriesExists = true;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
ChartSeriesExists = false;
}
}
Public Shared Function ChartHas_SeriesCollection(ByVal objSeriesColl As Excel.SeriesCollection, _
ByVal iSeriesNo As System.Int32) As Boolean
Try
'an error occurs when the series number is valid but not plotted - eg Pie Charts
Dim objSeries As Excel.Series

objSeries = objSeriesColl.Item(iSeriesNo)

ChartSeriesExists = True

Catch objCOMException As System.Runtime.InteropServices.COMException

ChartSeriesExists = False

End Try
End Function

ChartReturns_3DBarShape

public Excel.XlBarShape ChartReturns_3DBarShape(string sBarShapeKey)
{
Excel.XlBarShape objtemp;

try
{
if (clsError.ErrorFlag() == true)
return;

switch (sBarShapeKey)
{
case "BX":
{
objtemp = Excel.XlBarShape.xlBox;
break;
}

case "CTM":
{
objtemp = Excel.XlBarShape.xlConeToMax;
break;
}

case "CTP":
{
objtemp = Excel.XlBarShape.xlConeToPoint;
break;
}

case "CY":
{
objtemp = Excel.XlBarShape.xlCylinder;
break;
}

case "PTM":
{
objtemp = Excel.XlBarShape.xlPyramidToMax;
break;
}

case "PTP":
{
objtemp = Excel.XlBarShape.xlPyramidToPoint;
break;
}

default:
{
MsgBox("Incorrect Border Weight abbreviation : " + sBarShapeKey, Title: "ChartReturns_3DBarShape");
break;
}
}
ChartReturns_3DBarShape = objtemp;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objtemp = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartReturns_3DBarShape", msMODULENAME, "return the corresponding 3D shape for the abbreviation " + "'" + sBarShapeKey + "'.", gobjCOMException, gobjException);
}
}
Public Function ChartReturns_3DBarShape(ByVal sBarShapeKey As String) _
As Excel.XlBarShape

Dim objtemp As Excel.XlBarShape

Try
If clsError.ErrorFlag() = True Then Exit Function

Select Case sBarShapeKey
Case "BX" : objtemp = Excel.XlBarShape.xlBox
Case "CTM" : objtemp = Excel.XlBarShape.xlConeToMax
Case "CTP" : objtemp = Excel.XlBarShape.xlConeToPoint
Case "CY" : objtemp = Excel.XlBarShape.xlCylinder
Case "PTM" : objtemp = Excel.XlBarShape.xlPyramidToMax
Case "PTP" : objtemp = Excel.XlBarShape.xlPyramidToPoint
Case Else
Call MsgBox("Incorrect Border Weight abbreviation : " & _
sBarShapeKey, , _
"ChartReturns_3DBarShape")
End Select
ChartReturns_3DBarShape = objtemp

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objtemp = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartReturns_3DBarShape", msMODULENAME, _
"return the corresponding 3D shape for the abbreviation " & _
"'" & sBarShapeKey & "'.", _
gobjCOMException, gobjException)
End If
End Try
End Function

ChartReturns_AxisCategoryType

public Excel.XlCategoryType ChartReturns_AxisCategoryType(string sAxisCategoryTypeKey)
{
Excel.XlCategoryType objtemp;

try
{
if (clsError.ErrorFlag() == true)
return;

switch (sAxisCategoryTypeKey) // cant set this for a value chart
{
case "CA":
{
objtemp = Excel.XlCategoryType.xlCategoryScale;
break;
}

case "TS":
{
objtemp = Excel.XlCategoryType.xlTimeScale;
break;
}

case "AS":
{
objtemp = Excel.XlCategoryType.xlAutomaticScale;
break;
}

default:
{
MsgBox("Incorrect Axis Category Type abbreviation : " + sAxisCategoryTypeKey, Title: "ChartReturns_AxesCategoryType");
break;
}
}
ChartReturns_AxisCategoryType = objtemp;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objtemp = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartReturns_AxesCategoryType", msMODULENAME, "return the corresponding axis category type for the abbreviation " + "'" + sAxisCategoryTypeKey + "'.", gobjCOMException, gobjException);
}
}
Public Function ChartReturns_AxisCategoryType(ByVal sAxisCategoryTypeKey As String) _
As Excel.XlCategoryType

Dim objtemp As Excel.XlCategoryType

Try
If clsError.ErrorFlag() = True Then Exit Function

Select Case sAxisCategoryTypeKey 'cant set this for a value chart
Case "CA" : objtemp = Excel.XlCategoryType.xlCategoryScale
Case "TS" : objtemp = Excel.XlCategoryType.xlTimeScale
Case "AS" : objtemp = Excel.XlCategoryType.xlAutomaticScale
Case Else
Call MsgBox("Incorrect Axis Category Type abbreviation : " & _
sAxisCategoryTypeKey, , _
"ChartReturns_AxesCategoryType")

End Select
ChartReturns_AxisCategoryType = objtemp

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objtemp = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartReturns_AxesCategoryType", msMODULENAME, _
"return the corresponding axis category type for the abbreviation " & _
"'" & sAxisCategoryTypeKey & "'.", _
gobjCOMException, gobjException)
End If
End Try
End Function

ChartReturns_AxisGroup

public Excel.XlAxisGroup ChartReturns_AxisGroup(string sAxisGroupKey)
{
Excel.XlAxisGroup objtemp;

try
{
if (clsError.ErrorFlag() == true)
return;

switch (sAxisGroupKey)
{
case "P":
{
objtemp = Excel.XlAxisGroup.xlPrimary;
break;
}

case "S":
{
objtemp = Excel.XlAxisGroup.xlSecondary;
break;
}

default:
{
MsgBox("Incorrect Axis Group abbreviation : " + sAxisGroupKey, Title: "ChartReturns_AxesGroup");
break;
}
}

ChartReturns_AxisGroup = objtemp;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objtemp = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartReturns_AxisGroup", msMODULENAME, "return the corresponding axis group for the abbreviation " + "'" + sAxisGroupKey + "'.", gobjCOMException, gobjException);
}
}
Public Function ChartReturns_AxisGroup(ByVal sAxisGroupKey As String) _
As Excel.XlAxisGroup


Dim objtemp As Excel.XlAxisGroup

Try
If clsError.ErrorFlag() = True Then Exit Function

Select Case sAxisGroupKey
Case "P" : objtemp = Excel.XlAxisGroup.xlPrimary
Case "S" : objtemp = Excel.XlAxisGroup.xlSecondary
Case Else
Call MsgBox("Incorrect Axis Group abbreviation : " & _
sAxisGroupKey, , _
"ChartReturns_AxesGroup")
End Select

ChartReturns_AxisGroup = objtemp

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objtemp = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartReturns_AxisGroup", msMODULENAME, _
"return the corresponding axis group for the abbreviation " & _
"'" & sAxisGroupKey & "'.", _
gobjCOMException, gobjException)
End If
End Try
End Function

ChartReturns_AxisType

public Excel.XlAxisType ChartReturns_AxisType(string sAxisTypeKey)
{
Excel.XlAxisType objtemp;

try
{
if (clsError.ErrorFlag() == true)
return;

switch (sAxisTypeKey)
{
case "V":
{
objtemp = Excel.XlAxisType.xlValue; // the y - axis
break;
}

case "C":
{
objtemp = Excel.XlAxisType.xlCategory; // the x - axis
break;
}

case "S":
{
objtemp = Excel.XlAxisType.xlSeriesAxis; // only for 3D charts
break;
}

default:
{
MsgBox("Incorrect Axis Type abbreviation : " + sAxisTypeKey, Title: "ChartReturns_AxisType");
break;
}
}
ChartReturns_AxisType = objtemp;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objtemp = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartReturns_AxisType", msMODULENAME, "return the corresponding axis type for the abbreviation " + "'" + sAxisTypeKey + "'.", gobjCOMException, gobjException);
}
}
Public Function ChartReturns_AxisType(ByVal sAxisTypeKey As String) _
As Excel.XlAxisType

Dim objtemp As Excel.XlAxisType

Try
If clsError.ErrorFlag() = True Then Exit Function

Select Case sAxisTypeKey
Case "V" : objtemp = Excel.XlAxisType.xlValue 'the y - axis
Case "C" : objtemp = Excel.XlAxisType.xlCategory 'the x - axis
Case "S" : objtemp = Excel.XlAxisType.xlSeriesAxis 'only for 3D charts

Case Else
Call MsgBox("Incorrect Axis Type abbreviation : " & _
sAxisTypeKey, , _
"ChartReturns_AxisType")

End Select
ChartReturns_AxisType = objtemp

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objtemp = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartReturns_AxisType", msMODULENAME, _
"return the corresponding axis type for the abbreviation " & _
"'" & sAxisTypeKey & "'.", _
gobjCOMException, gobjException)
End If
End Try
End Function

ChartReturns_Background

public Excel.XlBackground ChartReturns_Background(string sBackgroundKey)
{
Excel.XlBackground objtemp;

try
{
if (clsError.ErrorFlag() == true)
return;

switch (sBackgroundKey)
{
case "AU":
{
objtemp = Excel.XlBackground.xlBackgroundAutomatic;
break;
}

case "OP":
{
objtemp = Excel.XlBackground.xlBackgroundOpaque;
break;
}

case "TR":
{
objtemp = Excel.XlBackground.xlBackgroundTransparent;
break;
}

default:
{
MsgBox("Incorrect Background abbreviation : " + sBackgroundKey, Title: "ChartReturns_BackgroundType");
break;
}
}
ChartReturns_Background = objtemp;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objtemp = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartReturns_Background", msMODULENAME, "return the corresponding background type for the abbreviation " + "'" + sBackgroundKey + "'.", gobjCOMException, gobjException);
}
}
Public Function ChartReturns_Background(ByVal sBackgroundKey As String) _
As Excel.XlBackground

Dim objtemp As Excel.XlBackground

Try
If clsError.ErrorFlag() = True Then Exit Function

Select Case sBackgroundKey
Case "AU" : objtemp = Excel.XlBackground.xlBackgroundAutomatic
Case "OP" : objtemp = Excel.XlBackground.xlBackgroundOpaque
Case "TR" : objtemp = Excel.XlBackground.xlBackgroundTransparent
Case Else
Call MsgBox("Incorrect Background abbreviation : " & _
sBackgroundKey, , _
"ChartReturns_BackgroundType")

End Select
ChartReturns_Background = objtemp

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objtemp = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartReturns_Background", msMODULENAME, _
"return the corresponding background type for the abbreviation " & _
"'" & sBackgroundKey & "'.", _
gobjCOMException, gobjException)
End If
End Try
End Function

ChartReturns_BorderWeight

public Excel.XlBorderWeight ChartReturns_BorderWeight(int sBorderWeightKey)
{
Excel.XlBorderWeight objtemp;

try
{
if (clsError.ErrorFlag() == true)
return;

switch (sBorderWeightKey)
{
case 1:
{
objtemp = Excel.XlBorderWeight.xlHairline;
break;
}

case 2:
{
objtemp = Excel.XlBorderWeight.xlThin;
break;
}

case 3:
{
objtemp = Excel.XlBorderWeight.xlMedium;
break;
}

case 4:
{
objtemp = Excel.XlBorderWeight.xlThick;
break;
}

default:
{
MsgBox("Incorrect Border Weight number : " + sBorderWeightKey, Title: "ChartReturns_BorderWeight");
break;
}
}
ChartReturns_BorderWeight = objtemp;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objtemp = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartReturns_BorderWeight", msMODULENAME, "return the corresponding border weight for the abbreviation " + "'" + sBorderWeightKey + "'.", gobjCOMException, gobjException);
}
}
Public Function ChartReturns_BorderWeight(ByVal sBorderWeightKey As Integer) _
As Excel.XlBorderWeight

Dim objtemp As Excel.XlBorderWeight

Try
If clsError.ErrorFlag() = True Then Exit Function

Select Case sBorderWeightKey
Case 1 : objtemp = Excel.XlBorderWeight.xlHairline
Case 2 : objtemp = Excel.XlBorderWeight.xlThin
Case 3 : objtemp = Excel.XlBorderWeight.xlMedium
Case 4 : objtemp = Excel.XlBorderWeight.xlThick
Case Else
Call MsgBox("Incorrect Border Weight number : " & _
sBorderWeightKey, , _
"ChartReturns_BorderWeight")

End Select
ChartReturns_BorderWeight = objtemp

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objtemp = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartReturns_BorderWeight", msMODULENAME, _
"return the corresponding border weight for the abbreviation " & _
"'" & sBorderWeightKey & "'.", _
gobjCOMException, gobjException)
End If
End Try
End Function

ChartReturns_DataLabelPosition

public Excel.XlDataLabelPosition ChartReturns_DataLabelPosition(string sDataLabelPosKey)
{
Excel.XlDataLabelPosition objtemp;

try
{
if (clsError.ErrorFlag() == true)
return;

switch (sDataLabelPosKey)
{
case "AB":
{
objtemp = Excel.XlDataLabelPosition.xlLabelPositionAbove;
break;
}

case "BL":
{
objtemp = Excel.XlDataLabelPosition.xlLabelPositionBelow;
break;
}

case "BF":
{
objtemp = Excel.XlDataLabelPosition.xlLabelPositionBestFit;
break;
}

case "CT":
{
objtemp = Excel.XlDataLabelPosition.xlLabelPositionCenter;
break;
}

case "CU":
{
objtemp = Excel.XlDataLabelPosition.xlLabelPositionCustom;
break;
}

case "IB":
{
objtemp = Excel.XlDataLabelPosition.xlLabelPositionInsideBase;
break;
}

case "IE":
{
objtemp = Excel.XlDataLabelPosition.xlLabelPositionInsideEnd;
break;
}

case "LF":
{
objtemp = Excel.XlDataLabelPosition.xlLabelPositionLeft;
break;
}

case "MX":
{
objtemp = Excel.XlDataLabelPosition.xlLabelPositionMixed;
break;
}

case "OE":
{
objtemp = Excel.XlDataLabelPosition.xlLabelPositionOutsideEnd;
break;
}

case "RI":
{
objtemp = Excel.XlDataLabelPosition.xlLabelPositionRight;
break;
}

default:
{
MsgBox("Incorrect Data Label Position abbreviation : " + sDataLabelPosKey, Title: "ChartReturns_DataLabelPosition");
break;
}
}
ChartReturns_DataLabelPosition = objtemp;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objtemp = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartReturns_DataLabelPosition", msMODULENAME, "return the corresponding data label position for the abbreviation " + "'" + sDataLabelPosKey + "'.", gobjCOMException, gobjException);
}
}
Public Function ChartReturns_DataLabelPosition(ByVal sDataLabelPosKey As String) _
As Excel.XlDataLabelPosition

Dim objtemp As Excel.XlDataLabelPosition

Try
If clsError.ErrorFlag() = True Then Exit Function

Select Case sDataLabelPosKey
Case "AB" : objtemp = Excel.XlDataLabelPosition.xlLabelPositionAbove
Case "BL" : objtemp = Excel.XlDataLabelPosition.xlLabelPositionBelow
Case "BF" : objtemp = Excel.XlDataLabelPosition.xlLabelPositionBestFit
Case "CT" : objtemp = Excel.XlDataLabelPosition.xlLabelPositionCenter
Case "CU" : objtemp = Excel.XlDataLabelPosition.xlLabelPositionCustom
Case "IB" : objtemp = Excel.XlDataLabelPosition.xlLabelPositionInsideBase
Case "IE" : objtemp = Excel.XlDataLabelPosition.xlLabelPositionInsideEnd
Case "LF" : objtemp = Excel.XlDataLabelPosition.xlLabelPositionLeft
Case "MX" : objtemp = Excel.XlDataLabelPosition.xlLabelPositionMixed
Case "OE" : objtemp = Excel.XlDataLabelPosition.xlLabelPositionOutsideEnd
Case "RI" : objtemp = Excel.XlDataLabelPosition.xlLabelPositionRight
Case Else
Call MsgBox("Incorrect Data Label Position abbreviation : " & _
sDataLabelPosKey, , _
"ChartReturns_DataLabelPosition")

End Select
ChartReturns_DataLabelPosition = objtemp

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objtemp = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartReturns_DataLabelPosition", msMODULENAME, _
"return the corresponding data label position for the abbreviation " & _
"'" & sDataLabelPosKey & "'.", _
gobjCOMException, gobjException)
End If
End Try
End Function

ChartReturns_DataLabelsType

public Excel.XlDataLabelsType ChartReturns_DataLabelsType(string sDataLabelTypeKey)
{
Excel.XlDataLabelsType objtemp;

try
{
if (clsError.ErrorFlag() == true)
return;

switch (sDataLabelTypeKey)
{
case "NO":
{
objtemp = Excel.XlDataLabelsType.xlDataLabelsShowNone;
break;
}

case "VA":
{
objtemp = Excel.XlDataLabelsType.xlDataLabelsShowValue;
break;
}

case "PC":
{
objtemp = Excel.XlDataLabelsType.xlDataLabelsShowPercent;
break;
}

case "LB":
{
objtemp = Excel.XlDataLabelsType.xlDataLabelsShowLabel;
break;
}

case "LBPC":
{
objtemp = Excel.XlDataLabelsType.xlDataLabelsShowLabelAndPercent;
break;
}

default:
{
MsgBox("Incorrect Data Label Type abbreviation : " + sDataLabelTypeKey, Title: "ChartReturns_DataLabelPosition");
break;
}
}
ChartReturns_DataLabelsType = objtemp;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartReturns_DataLabelsType", msMODULENAME, "return the corresponding data label type for the abbreviation " + "'" + sDataLabelTypeKey + "'.", gobjCOMException, gobjException);
}
}
Public Function ChartReturns_DataLabelsType(ByVal sDataLabelTypeKey As String) _
As Excel.XlDataLabelsType

Dim objtemp As Excel.XlDataLabelsType

Try
If clsError.ErrorFlag() = True Then Exit Function

Select Case sDataLabelTypeKey
Case "NO" : objtemp = Excel.XlDataLabelsType.xlDataLabelsShowNone
Case "VA" : objtemp = Excel.XlDataLabelsType.xlDataLabelsShowValue
Case "PC" : objtemp = Excel.XlDataLabelsType.xlDataLabelsShowPercent
Case "LB" : objtemp = Excel.XlDataLabelsType.xlDataLabelsShowLabel
Case "LBPC" : objtemp = Excel.XlDataLabelsType.xlDataLabelsShowLabelAndPercent
Case Else
Call MsgBox("Incorrect Data Label Type abbreviation : " & _
sDataLabelTypeKey, , _
"ChartReturns_DataLabelPosition")

End Select
ChartReturns_DataLabelsType = objtemp

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartReturns_DataLabelsType", msMODULENAME, _
"return the corresponding data label type for the abbreviation " & _
"'" & sDataLabelTypeKey & "'.", _
gobjCOMException, gobjException)
End If
End Try
End Function

ChartReturns_FontName

public string ChartReturns_FontName(string sFontNameKey)
{
try
{
if (clsError.ErrorFlag() == true)
return;

string stemp;

if (sFontNameKey == "")
sFontNameKey = "AR";
switch (sFontNameKey)
{
case "UN":
{
stemp = "UniversLight";
break;
}

case "AR":
{
stemp = "Arial";
break;
}

case "HL":
{
stemp = "Helvetica";
break;
}

case "TN":
{
stemp = "Times New Roman";
break;
}

case "AN":
{
stemp = "ArialNarrow";
break;
}

case "AB":
{
stemp = "Arial Black";
break;
}

case "SB":
{
stemp = "Sabon";
break;
}

case "MS":
{
stemp = "Monotype sorts";
break;
}

case "VB":
{
stemp = "VeticaBlack";
break;
}

default:
{
MsgBox("Incorrect Font Name abbreviation : " + sFontNameKey, Title: "ChartReturns_FontName");
break;
}
}
ChartReturns_FontName = stemp;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartReturns_FontName", msMODULENAME, "return the corresponding font name for the abbreviation " + "'" + sFontNameKey + "'.", gobjCOMException, gobjException);
}
}
Public Function ChartReturns_FontName(ByVal sFontNameKey As String) _
As String

Try
If clsError.ErrorFlag() = True Then Exit Function

Dim stemp As String

If sFontNameKey = "" Then sFontNameKey = "AR"
Select Case sFontNameKey
Case "UN" : stemp = "UniversLight"
Case "AR" : stemp = "Arial"
Case "HL" : stemp = "Helvetica"
Case "TN" : stemp = "Times New Roman"
Case "AN" : stemp = "ArialNarrow"
Case "AB" : stemp = "Arial Black"
Case "SB" : stemp = "Sabon"
Case "MS" : stemp = "Monotype sorts"
Case "VB" : stemp = "VeticaBlack"
Case Else
Call MsgBox("Incorrect Font Name abbreviation : " & _
sFontNameKey, , _
"ChartReturns_FontName")

End Select
ChartReturns_FontName = stemp

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartReturns_FontName", msMODULENAME, _
"return the corresponding font name for the abbreviation " & _
"'" & sFontNameKey & "'.", _
gobjCOMException, gobjException)
End If
End Try
End Function

ChartReturns_GradientStyle

public Office.MsoGradientStyle ChartReturns_GradientStyle(string sGradientStyleKey)
{
Office.MsoGradientStyle objtemp;

try
{
if (clsError.ErrorFlag() == true)
return;

switch (sGradientStyleKey)
{
case "DDW":
{
objtemp = Office.MsoGradientStyle.msoGradientDiagonalDown;
break;
}

case "DUP":
{
objtemp = Office.MsoGradientStyle.msoGradientDiagonalUp;
break;
}

case "FCE":
{
objtemp = Office.MsoGradientStyle.msoGradientFromCenter;
break;
}

case "FCR":
{
objtemp = Office.MsoGradientStyle.msoGradientFromCorner;
break;
}

case "HR":
{
objtemp = Office.MsoGradientStyle.msoGradientHorizontal;
break;
}

case "VR":
{
objtemp = Office.MsoGradientStyle.msoGradientVertical;
break;
}

case "MX":
{
objtemp = Office.MsoGradientStyle.msoGradientMixed;
break;
}

default:
{
MsgBox("Incorrect Gradient Style abbreviation : " + sGradientStyleKey, Title: "ChartReturns_GradientStyle");
break;
}
}
ChartReturns_GradientStyle = objtemp;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objtemp = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartReturns_GradientStyle", msMODULENAME, "return the corresponding gradient style for the abbreviation " + "'" + sGradientStyleKey + "'.", gobjCOMException, gobjException);
}
}
Public Function ChartReturns_GradientStyle(ByVal sGradientStyleKey As String) _
As Office.MsoGradientStyle

Dim objtemp As Office.MsoGradientStyle

Try
If clsError.ErrorFlag() = True Then Exit Function

Select Case sGradientStyleKey
Case "DDW" : objtemp = Office.MsoGradientStyle.msoGradientDiagonalDown
Case "DUP" : objtemp = Office.MsoGradientStyle.msoGradientDiagonalUp
Case "FCE" : objtemp = Office.MsoGradientStyle.msoGradientFromCenter
Case "FCR" : objtemp = Office.MsoGradientStyle.msoGradientFromCorner
Case "HR" : objtemp = Office.MsoGradientStyle.msoGradientHorizontal
Case "VR" : objtemp = Office.MsoGradientStyle.msoGradientVertical
Case "MX" : objtemp = Office.MsoGradientStyle.msoGradientMixed
Case Else
Call MsgBox("Incorrect Gradient Style abbreviation : " & _
sGradientStyleKey, , _
"ChartReturns_GradientStyle")

End Select
ChartReturns_GradientStyle = objtemp

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objtemp = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartReturns_GradientStyle", msMODULENAME, _
"return the corresponding gradient style for the abbreviation " & _
"'" & sGradientStyleKey & "'.", _
gobjCOMException, gobjException)
End If
End Try
End Function

ChartReturns_LegendPosition

public Excel.XlLegendPosition ChartReturns_LegendPosition(string sLegendPositionKey)
{
Excel.XlLegendPosition objtemp;

try
{
if (clsError.ErrorFlag() == true)
return;

switch (sLegendPositionKey)
{
case "TP":
{
objtemp = Excel.XlLegendPosition.xlLegendPositionTop;
break;
}

case "BT":
{
objtemp = Excel.XlLegendPosition.xlLegendPositionBottom;
break;
}

case "RI":
{
objtemp = Excel.XlLegendPosition.xlLegendPositionRight;
break;
}

case "LF":
{
objtemp = Excel.XlLegendPosition.xlLegendPositionLeft;
break;
}

case "CR":
{
objtemp = Excel.XlLegendPosition.xlLegendPositionCorner;
break;
}

default:
{
MsgBox("Incorrect Legend Position abbreviation : " + sLegendPositionKey, Title: "ChartReturns_LegendPosition");
break;
}
}
ChartReturns_LegendPosition = objtemp;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objtemp = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartReturns_LegendPosition", msMODULENAME, "return the corresponding legend position for the abbreviation " + "'" + sLegendPositionKey + "'.", gobjCOMException, gobjException);
}
}
Public Function ChartReturns_LegendPosition(ByVal sLegendPositionKey As String) _
As Excel.XlLegendPosition

Dim objtemp As Excel.XlLegendPosition

Try
If clsError.ErrorFlag() = True Then Exit Function

Select Case sLegendPositionKey
Case "TP" : objtemp = Excel.XlLegendPosition.xlLegendPositionTop
Case "BT" : objtemp = Excel.XlLegendPosition.xlLegendPositionBottom
Case "RI" : objtemp = Excel.XlLegendPosition.xlLegendPositionRight
Case "LF" : objtemp = Excel.XlLegendPosition.xlLegendPositionLeft
Case "CR" : objtemp = Excel.XlLegendPosition.xlLegendPositionCorner
Case Else
Call MsgBox("Incorrect Legend Position abbreviation : " & _
sLegendPositionKey, , _
"ChartReturns_LegendPosition")

End Select
ChartReturns_LegendPosition = objtemp

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objtemp = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartReturns_LegendPosition", msMODULENAME, _
"return the corresponding legend position for the abbreviation " & _
"'" & sLegendPositionKey & "'.", _
gobjCOMException, gobjException)
End If
End Try
End Function

ChartReturns_LineStyle

public Excel.XlLineStyle ChartReturns_LineStyle(string sLineStyleKey)
{
Excel.XlLineStyle objtemp;

try
{
if (clsError.ErrorFlag() == true)
return;

// Case "AU" : ltemporary = Excel.XlLineStyle.xlAutomatic
switch (sLineStyleKey)
{
case "NO":
{
objtemp = Excel.XlLineStyle.xlLineStyleNone; // xlNone
break;
}

case "CT":
{
objtemp = Excel.XlLineStyle.xlContinuous;
break;
}

case "DS":
{
objtemp = Excel.XlLineStyle.xlDash;
break;
}

case "DT":
{
objtemp = Excel.XlLineStyle.xlDot;
break;
}

case "DDT":
{
objtemp = Excel.XlLineStyle.xlDashDot;
break;
}

case "DDD":
{
objtemp = Excel.XlLineStyle.xlDashDotDot;
break;
}

case "DBL":
{
objtemp = Excel.XlLineStyle.xlDouble;
break;
}

case "SDD":
{
objtemp = Excel.XlLineStyle.xlSlantDashDot;
break;
}

default:
{
MsgBox("Incorrect Line Style : " + sLineStyleKey, Title: "ChartReturns_LineStyle");
break;
}
}
ChartReturns_LineStyle = objtemp;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objtemp = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartReturns_LineStyle", msMODULENAME, "return the corresponding line style for the abbreviation " + "'" + sLineStyleKey + "'.", gobjCOMException, gobjException);
}
}
Public Function ChartReturns_LineStyle(ByVal sLineStyleKey As String) _
As Excel.XlLineStyle

Dim objtemp As Excel.XlLineStyle

Try
If clsError.ErrorFlag() = True Then Exit Function

'Case "AU" : ltemporary = Excel.XlLineStyle.xlAutomatic
Select Case sLineStyleKey
Case "NO" : objtemp = Excel.XlLineStyle.xlLineStyleNone 'xlNone
Case "CT" : objtemp = Excel.XlLineStyle.xlContinuous
Case "DS" : objtemp = Excel.XlLineStyle.xlDash
Case "DT" : objtemp = Excel.XlLineStyle.xlDot
Case "DDT" : objtemp = Excel.XlLineStyle.xlDashDot
Case "DDD" : objtemp = Excel.XlLineStyle.xlDashDotDot

Case "DBL" : objtemp = Excel.XlLineStyle.xlDouble
Case "SDD" : objtemp = Excel.XlLineStyle.xlSlantDashDot

'Case "G25" : objtemporary = -4124 'Excel.XlLineStyle.xlGray25
'Case "G50" : objtemporary = -4125 'Excel.XlLineStyle.xlGray50
'Case "G75" : objtemporary = -4126 'Excel.XlLineStyle.xlGray75
Case Else
Call MsgBox("Incorrect Line Style : " & sLineStyleKey, , _
"ChartReturns_LineStyle")

End Select
ChartReturns_LineStyle = objtemp

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objtemp = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartReturns_LineStyle", msMODULENAME, _
"return the corresponding line style for the abbreviation " & _
"'" & sLineStyleKey & "'.", _
gobjCOMException, gobjException)
End If
End Try
End Function

ChartReturns_MarkerStyle

public Excel.XlMarkerStyle ChartReturns_MarkerStyle(string sMarkerStyleKey)
{
Excel.XlMarkerStyle objtemp;

try
{
if (clsError.ErrorFlag() == true)
return;

switch (sMarkerStyleKey)
{
case "NO":
{
objtemp = Excel.XlMarkerStyle.xlMarkerStyleNone;
break;
}

case "AU":
{
objtemp = Excel.XlMarkerStyle.xlMarkerStyleAutomatic;
break;
}

case "SQ":
{
objtemp = Excel.XlMarkerStyle.xlMarkerStyleSquare;
break;
}

case "DI":
{
objtemp = Excel.XlMarkerStyle.xlMarkerStyleDiamond;
break;
}

case "TR":
{
objtemp = Excel.XlMarkerStyle.xlMarkerStyleTriangle;
break;
}

case "XX":
{
objtemp = Excel.XlMarkerStyle.xlMarkerStyleX;
break;
}

case "ST":
{
objtemp = Excel.XlMarkerStyle.xlMarkerStyleStar;
break;
}

case "DT":
{
objtemp = Excel.XlMarkerStyle.xlMarkerStyleDot;
break;
}

case "DS":
{
objtemp = Excel.XlMarkerStyle.xlMarkerStyleDash;
break;
}

case "CR":
{
objtemp = Excel.XlMarkerStyle.xlMarkerStyleCircle;
break;
}

case "PL":
{
objtemp = Excel.XlMarkerStyle.xlMarkerStylePlus;
break;
}

default:
{
MsgBox("Incorrect Marker Style abbreviation : " + sMarkerStyleKey, Title: "ChartReturns_MarkerStyle");
break;
}
}
ChartReturns_MarkerStyle = objtemp;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objtemp = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartReturns_MarkerStyle", msMODULENAME, "return the corresponding marker style for the abbreviation " + "'" + sMarkerStyleKey + "'.", gobjCOMException, gobjException);
}
}
Public Function ChartReturns_MarkerStyle(ByVal sMarkerStyleKey As String) _
As Excel.XlMarkerStyle

Dim objtemp As Excel.XlMarkerStyle

Try
If clsError.ErrorFlag() = True Then Exit Function

Select Case sMarkerStyleKey
Case "NO" : objtemp = Excel.XlMarkerStyle.xlMarkerStyleNone
Case "AU" : objtemp = Excel.XlMarkerStyle.xlMarkerStyleAutomatic
Case "SQ" : objtemp = Excel.XlMarkerStyle.xlMarkerStyleSquare
Case "DI" : objtemp = Excel.XlMarkerStyle.xlMarkerStyleDiamond
Case "TR" : objtemp = Excel.XlMarkerStyle.xlMarkerStyleTriangle
Case "XX" : objtemp = Excel.XlMarkerStyle.xlMarkerStyleX
Case "ST" : objtemp = Excel.XlMarkerStyle.xlMarkerStyleStar
Case "DT" : objtemp = Excel.XlMarkerStyle.xlMarkerStyleDot
Case "DS" : objtemp = Excel.XlMarkerStyle.xlMarkerStyleDash
Case "CR" : objtemp = Excel.XlMarkerStyle.xlMarkerStyleCircle
Case "PL" : objtemp = Excel.XlMarkerStyle.xlMarkerStylePlus
Case Else
Call MsgBox("Incorrect Marker Style abbreviation : " & _
sMarkerStyleKey, , _
"ChartReturns_MarkerStyle")

End Select
ChartReturns_MarkerStyle = objtemp

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objtemp = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartReturns_MarkerStyle", msMODULENAME, _
"return the corresponding marker style for the abbreviation " & _
"'" & sMarkerStyleKey & "'.", _
gobjCOMException, gobjException)
End If
End Try
End Function

ChartReturns_Pattern

public Excel.XlPattern ChartReturns_Pattern(string sPatternKey)
{
Excel.XlPattern objtemp;

try
{
if (clsError.ErrorFlag() == true)
return;

switch (sPatternKey)
{
case "NO":
{
objtemp = Excel.XlPattern.xlPatternNone;
break;
}

case "SLD":
{
objtemp = Excel.XlPattern.xlPatternSolid;
break;
}

case "SD":
{
objtemp = Excel.XlPattern.xlPatternSolid;
break;
}

case "AU":
{
objtemp = Excel.XlPattern.xlPatternAutomatic;
break;
}

case "CH":
{
objtemp = Excel.XlPattern.xlPatternChecker;
break;
}

case "CC":
{
objtemp = Excel.XlPattern.xlPatternCrissCross;
break;
}

case "G16":
{
objtemp = Excel.XlPattern.xlPatternGray16;
break;
}

case "G25":
{
objtemp = Excel.XlPattern.xlPatternGray25;
break;
}

case "G50":
{
objtemp = Excel.XlPattern.xlPatternGray50;
break;
}

case "G75":
{
objtemp = Excel.XlPattern.xlPatternGray75;
break;
}

case "G8":
{
objtemp = Excel.XlPattern.xlPatternGray8;
break;
}

case "GR":
{
objtemp = Excel.XlPattern.xlPatternGrid;
break;
}

case "UP":
{
objtemp = Excel.XlPattern.xlPatternUp;
break;
}

case "DN":
{
objtemp = Excel.XlPattern.xlPatternDown;
break;
}

case "HR":
{
objtemp = Excel.XlPattern.xlPatternHorizontal;
break;
}

case "VT":
{
objtemp = Excel.XlPattern.xlPatternVertical;
break;
}

case "LU":
{
objtemp = Excel.XlPattern.xlPatternLightUp;
break;
}

case "LD":
{
objtemp = Excel.XlPattern.xlPatternLightDown;
break;
}

case "LH":
{
objtemp = Excel.XlPattern.xlPatternLightHorizontal;
break;
}

case "LV":
{
objtemp = Excel.XlPattern.xlPatternLightVertical;
break;
}

case "SG75":
{
objtemp = Excel.XlPattern.xlPatternSemiGray75;
break;
}

default:
{
MsgBox("Incorrect Pattern Style abbreviation : " + sPatternKey, Title: "ChartReturns_Pattern");
break;
}
}
ChartReturns_Pattern = objtemp;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objtemp = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartReturns_Pattern", msMODULENAME, "return the corresponding pattern for the abbreviation " + "'" + sPatternKey + "'.", gobjCOMException, gobjException);
}
}
Public Function ChartReturns_Pattern(ByVal sPatternKey As String) _
As Excel.XlPattern

Dim objtemp As Excel.XlPattern

Try
If clsError.ErrorFlag() = True Then Exit Function

Select Case sPatternKey
Case "NO" : objtemp = Excel.XlPattern.xlPatternNone
Case "SLD" : objtemp = Excel.XlPattern.xlPatternSolid
Case "SD" : objtemp = Excel.XlPattern.xlPatternSolid
Case "AU" : objtemp = Excel.XlPattern.xlPatternAutomatic
Case "CH" : objtemp = Excel.XlPattern.xlPatternChecker
Case "CC" : objtemp = Excel.XlPattern.xlPatternCrissCross
Case "G16" : objtemp = Excel.XlPattern.xlPatternGray16
Case "G25" : objtemp = Excel.XlPattern.xlPatternGray25
Case "G50" : objtemp = Excel.XlPattern.xlPatternGray50
Case "G75" : objtemp = Excel.XlPattern.xlPatternGray75
Case "G8" : objtemp = Excel.XlPattern.xlPatternGray8
Case "GR" : objtemp = Excel.XlPattern.xlPatternGrid
Case "UP" : objtemp = Excel.XlPattern.xlPatternUp
Case "DN" : objtemp = Excel.XlPattern.xlPatternDown
Case "HR" : objtemp = Excel.XlPattern.xlPatternHorizontal
Case "VT" : objtemp = Excel.XlPattern.xlPatternVertical
Case "LU" : objtemp = Excel.XlPattern.xlPatternLightUp
Case "LD" : objtemp = Excel.XlPattern.xlPatternLightDown
Case "LH" : objtemp = Excel.XlPattern.xlPatternLightHorizontal
Case "LV" : objtemp = Excel.XlPattern.xlPatternLightVertical
Case "SG75" : objtemp = Excel.XlPattern.xlPatternSemiGray75
Case Else
Call MsgBox("Incorrect Pattern Style abbreviation : " & _
sPatternKey, , _
"ChartReturns_Pattern")

End Select
ChartReturns_Pattern = objtemp

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objtemp = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartReturns_Pattern", msMODULENAME, _
"return the corresponding pattern for the abbreviation " & _
"'" & sPatternKey & "'.", _
gobjCOMException, gobjException)
End If
End Try
End Function

ChartReturns_PatternType

public Office.MsoPatternType ChartReturns_PatternType(string sPatternTypeKey)
{
Office.MsoPatternType objtemp;

try
{
if (clsError.ErrorFlag() == true)
return;

switch (sPatternTypeKey)
{
case "5P":
{
objtemp = Office.MsoPatternType.msoPattern5Percent;
break;
}

case "10P":
{
objtemp = Office.MsoPatternType.msoPattern10Percent;
break;
}

case "20P":
{
objtemp = Office.MsoPatternType.msoPattern20Percent;
break;
}

case "25P":
{
objtemp = Office.MsoPatternType.msoPattern25Percent;
break;
}

case "30P":
{
objtemp = Office.MsoPatternType.msoPattern30Percent;
break;
}

case "40P":
{
objtemp = Office.MsoPatternType.msoPattern40Percent;
break;
}

case "50P":
{
objtemp = Office.MsoPatternType.msoPattern50Percent;
break;
}

case "60P":
{
objtemp = Office.MsoPatternType.msoPattern60Percent;
break;
}

case "70P":
{
objtemp = Office.MsoPatternType.msoPattern70Percent;
break;
}

case "75P":
{
objtemp = Office.MsoPatternType.msoPattern75Percent;
break;
}

case "80P":
{
objtemp = Office.MsoPatternType.msoPattern80Percent;
break;
}

case "90P":
{
objtemp = Office.MsoPatternType.msoPattern90Percent;
break;
}

case "DRKDWDI":
{
objtemp = Office.MsoPatternType.msoPatternDarkDownwardDiagonal;
break;
}

case "LHTDWDI":
{
objtemp = Office.MsoPatternType.msoPatternLightDownwardDiagonal;
break;
}

case "WDEDWDI":
{
objtemp = Office.MsoPatternType.msoPatternWideDownwardDiagonal;
break;
}

case "DSHDWDI":
{
objtemp = Office.MsoPatternType.msoPatternDashedDownwardDiagonal;
break;
}

case "DRKUPDI":
{
objtemp = Office.MsoPatternType.msoPatternDarkUpwardDiagonal;
break;
}

case "LHTUPDI":
{
objtemp = Office.MsoPatternType.msoPatternLightUpwardDiagonal;
break;
}

case "WDEUPDI":
{
objtemp = Office.MsoPatternType.msoPatternWideUpwardDiagonal;
break;
}

case "DSHUPDI":
{
objtemp = Office.MsoPatternType.msoPatternDashedUpwardDiagonal;
break;
}

case "DRKHR":
{
objtemp = Office.MsoPatternType.msoPatternDarkHorizontal;
break;
}

case "LHTHR":
{
objtemp = Office.MsoPatternType.msoPatternLightHorizontal;
break;
}

case "NRWHR":
{
objtemp = Office.MsoPatternType.msoPatternNarrowHorizontal;
break;
}

case "DRKVR":
{
objtemp = Office.MsoPatternType.msoPatternDarkVertical;
break;
}

case "LHTVR":
{
objtemp = Office.MsoPatternType.msoPatternLightVertical;
break;
}

case "NRWVR":
{
objtemp = Office.MsoPatternType.msoPatternNarrowVertical;
break;
}

case "DSHVR":
{
objtemp = Office.MsoPatternType.msoPatternDashedVertical;
break;
}

case "DSHHR":
{
objtemp = Office.MsoPatternType.msoPatternDashedHorizontal;
break;
}

case "DIABR":
{
objtemp = Office.MsoPatternType.msoPatternDiagonalBrick;
break;
}

case "DTDGR":
{
objtemp = Office.MsoPatternType.msoPatternDottedGrid;
break;
}

case "HRBR":
{
objtemp = Office.MsoPatternType.msoPatternHorizontalBrick;
break;
}

case "LRGCHBD":
{
objtemp = Office.MsoPatternType.msoPatternLargeCheckerBoard;
break;
}

case "SMLCHBD":
{
objtemp = Office.MsoPatternType.msoPatternSmallCheckerBoard;
break;
}

case "LRGCON":
{
objtemp = Office.MsoPatternType.msoPatternLargeConfetti;
break;
}

case "SMLCON":
{
objtemp = Office.MsoPatternType.msoPatternSmallConfetti;
break;
}

case "LRGGR":
{
objtemp = Office.MsoPatternType.msoPatternLargeGrid;
break;
}

case "SMLGR":
{
objtemp = Office.MsoPatternType.msoPatternSmallGrid;
break;
}

case "MX":
{
objtemp = Office.MsoPatternType.msoPatternMixed;
break;
}

case "TR":
{
objtemp = Office.MsoPatternType.msoPatternTrellis;
break;
}

case "WE":
{
objtemp = Office.MsoPatternType.msoPatternWeave;
break;
}

default:
{
MsgBox("Incorrect Pattern Style abbreviation : " + sPatternTypeKey, Title: "ChartReturns_PatternStyle");
break;
}
}
ChartReturns_PatternType = objtemp;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objtemp = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartReturns_PatternType", msMODULENAME, "return the corresponding pattern type for the abbreviation " + "'" + sPatternTypeKey + "'.", gobjCOMException, gobjException);
}
}
Public Function ChartReturns_PatternType(ByVal sPatternTypeKey As String) _
As Office.MsoPatternType

Dim objtemp As Office.MsoPatternType

Try
If clsError.ErrorFlag() = True Then Exit Function

Select Case sPatternTypeKey
Case "5P" : objtemp = Office.MsoPatternType.msoPattern5Percent
Case "10P" : objtemp = Office.MsoPatternType.msoPattern10Percent
Case "20P" : objtemp = Office.MsoPatternType.msoPattern20Percent
Case "25P" : objtemp = Office.MsoPatternType.msoPattern25Percent
Case "30P" : objtemp = Office.MsoPatternType.msoPattern30Percent
Case "40P" : objtemp = Office.MsoPatternType.msoPattern40Percent
Case "50P" : objtemp = Office.MsoPatternType.msoPattern50Percent
Case "60P" : objtemp = Office.MsoPatternType.msoPattern60Percent
Case "70P" : objtemp = Office.MsoPatternType.msoPattern70Percent
Case "75P" : objtemp = Office.MsoPatternType.msoPattern75Percent
Case "80P" : objtemp = Office.MsoPatternType.msoPattern80Percent
Case "90P" : objtemp = Office.MsoPatternType.msoPattern90Percent
Case "DRKDWDI" : objtemp = Office.MsoPatternType.msoPatternDarkDownwardDiagonal
Case "LHTDWDI" : objtemp = Office.MsoPatternType.msoPatternLightDownwardDiagonal
Case "WDEDWDI" : objtemp = Office.MsoPatternType.msoPatternWideDownwardDiagonal
Case "DSHDWDI" : objtemp = Office.MsoPatternType.msoPatternDashedDownwardDiagonal
Case "DRKUPDI" : objtemp = Office.MsoPatternType.msoPatternDarkUpwardDiagonal
Case "LHTUPDI" : objtemp = Office.MsoPatternType.msoPatternLightUpwardDiagonal
Case "WDEUPDI" : objtemp = Office.MsoPatternType.msoPatternWideUpwardDiagonal
Case "DSHUPDI" : objtemp = Office.MsoPatternType.msoPatternDashedUpwardDiagonal
Case "DRKHR" : objtemp = Office.MsoPatternType.msoPatternDarkHorizontal
Case "LHTHR" : objtemp = Office.MsoPatternType.msoPatternLightHorizontal
Case "NRWHR" : objtemp = Office.MsoPatternType.msoPatternNarrowHorizontal
Case "DRKVR" : objtemp = Office.MsoPatternType.msoPatternDarkVertical
Case "LHTVR" : objtemp = Office.MsoPatternType.msoPatternLightVertical
Case "NRWVR" : objtemp = Office.MsoPatternType.msoPatternNarrowVertical
Case "DSHVR" : objtemp = Office.MsoPatternType.msoPatternDashedVertical
Case "DSHHR" : objtemp = Office.MsoPatternType.msoPatternDashedHorizontal
Case "DIABR" : objtemp = Office.MsoPatternType.msoPatternDiagonalBrick
Case "DTDGR" : objtemp = Office.MsoPatternType.msoPatternDottedGrid
Case "HRBR" : objtemp = Office.MsoPatternType.msoPatternHorizontalBrick
Case "LRGCHBD" : objtemp = Office.MsoPatternType.msoPatternLargeCheckerBoard
Case "SMLCHBD" : objtemp = Office.MsoPatternType.msoPatternSmallCheckerBoard
Case "LRGCON" : objtemp = Office.MsoPatternType.msoPatternLargeConfetti
Case "SMLCON" : objtemp = Office.MsoPatternType.msoPatternSmallConfetti
Case "LRGGR" : objtemp = Office.MsoPatternType.msoPatternLargeGrid
Case "SMLGR" : objtemp = Office.MsoPatternType.msoPatternSmallGrid
Case "MX" : objtemp = Office.MsoPatternType.msoPatternMixed
Case "TR" : objtemp = Office.MsoPatternType.msoPatternTrellis
Case "WE" : objtemp = Office.MsoPatternType.msoPatternWeave

'Case "" : objtemp = Office.MsoPatternType.msoPatternLightDiamonds
'Case "" : objtemp = Office.MsoPatternType.msoPatternOutlinedDiamonds
'Case "" : objtemp = Office.MsoPatternType.msoPatternPlaidmsoPatternShingles
'Case "" : objtemp = Office.MsoPatternType.msoPatternSolidDiamonds
'Case "" : objtemp = Office.MsoPatternType.msoPatternSpheres
'Case "" : objtemp = Office.MsoPatternType.msoPatternWaves
'Case "" : objtemp = Office.MsoPatternType.msoPatternWavyLines
'Case "" : objtemp = Office.MsoPatternType.msoPatternDivits
Case Else
Call MsgBox("Incorrect Pattern Style abbreviation : " & _
sPatternTypeKey, , _
"ChartReturns_PatternStyle")

End Select
ChartReturns_PatternType = objtemp

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objtemp = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartReturns_PatternType", msMODULENAME, _
"return the corresponding pattern type for the abbreviation " & _
"'" & sPatternTypeKey & "'.", _
gobjCOMException, gobjException)
End If
End Try
End Function

ChartReturns_PresetGradientType

public Office.MsoPresetGradientType ChartReturns_PresetGradientType(string sPresetGradientStyleKey)
{
Office.MsoPresetGradientType objtemp;

try
{
if (clsError.ErrorFlag() == true)
return;

switch (sPresetGradientStyleKey)
{
case "BRS":
{
objtemp = Office.MsoPresetGradientType.msoGradientBrass;
break;
}

case "CLM":
{
objtemp = Office.MsoPresetGradientType.msoGradientCalmWater;
break;
}

case "CHR":
{
objtemp = Office.MsoPresetGradientType.msoGradientChrome;
break;
}

case "CHR2":
{
objtemp = Office.MsoPresetGradientType.msoGradientChromeII;
break;
}

case "DYB":
{
objtemp = Office.MsoPresetGradientType.msoGradientDaybreak;
break;
}

case "DES":
{
objtemp = Office.MsoPresetGradientType.msoGradientDesert;
break;
}

case "ESS":
{
objtemp = Office.MsoPresetGradientType.msoGradientEarlySunset;
break;
}

case "FIR":
{
objtemp = Office.MsoPresetGradientType.msoGradientFire;
break;
}

case "FOG":
{
objtemp = Office.MsoPresetGradientType.msoGradientFog;
break;
}

case "GLD":
{
objtemp = Office.MsoPresetGradientType.msoGradientGold;
break;
}

case "GLD2":
{
objtemp = Office.MsoPresetGradientType.msoGradientGoldII;
break;
}

case "HR":
{
objtemp = Office.MsoPresetGradientType.msoGradientHorizon;
break;
}

case "LSS":
{
objtemp = Office.MsoPresetGradientType.msoGradientLateSunset;
break;
}

case "MAH":
{
objtemp = Office.MsoPresetGradientType.msoGradientMahogany;
break;
}

case "MOS":
{
objtemp = Office.MsoPresetGradientType.msoGradientMoss;
break;
}

case "NFL":
{
objtemp = Office.MsoPresetGradientType.msoGradientNightfall;
break;
}

case "OCN":
{
objtemp = Office.MsoPresetGradientType.msoGradientOcean;
break;
}

case "PAR":
{
objtemp = Office.MsoPresetGradientType.msoGradientParchment;
break;
}

case "PCK":
{
objtemp = Office.MsoPresetGradientType.msoGradientPeacock;
break;
}

case "RNB":
{
objtemp = Office.MsoPresetGradientType.msoGradientRainbow;
break;
}

case "RNB2":
{
objtemp = Office.MsoPresetGradientType.msoGradientRainbowII;
break;
}

case "SAP":
{
objtemp = Office.MsoPresetGradientType.msoGradientSapphire;
break;
}

case "SLV":
{
objtemp = Office.MsoPresetGradientType.msoGradientSilver;
break;
}

case "WHT":
{
objtemp = Office.MsoPresetGradientType.msoGradientWheat;
break;
}

case "MX":
{
objtemp = Office.MsoPresetGradientType.msoPresetGradientMixed;
break;
}

default:
{
MsgBox("Incorrect Gradient Style abbreviation : " + sPresetGradientStyleKey, Title: "ChartReturns_PresetGradientType");
break;
}
}
ChartReturns_PresetGradientType = objtemp;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objtemp = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartReturns_GradientType", msMODULENAME, "return the corresponding preset gradient style for the abbreviation " + "'" + sPresetGradientStyleKey + "'.", gobjCOMException, gobjException);
}
}
Public Function ChartReturns_PresetGradientType(ByVal sPresetGradientStyleKey As String) _
As Office.MsoPresetGradientType

Dim objtemp As Office.MsoPresetGradientType

Try
If clsError.ErrorFlag() = True Then Exit Function

Select Case sPresetGradientStyleKey
Case "BRS" : objtemp = Office.MsoPresetGradientType.msoGradientBrass
Case "CLM" : objtemp = Office.MsoPresetGradientType.msoGradientCalmWater
Case "CHR" : objtemp = Office.MsoPresetGradientType.msoGradientChrome
Case "CHR2" : objtemp = Office.MsoPresetGradientType.msoGradientChromeII
Case "DYB" : objtemp = Office.MsoPresetGradientType.msoGradientDaybreak
Case "DES" : objtemp = Office.MsoPresetGradientType.msoGradientDesert
Case "ESS" : objtemp = Office.MsoPresetGradientType.msoGradientEarlySunset
Case "FIR" : objtemp = Office.MsoPresetGradientType.msoGradientFire
Case "FOG" : objtemp = Office.MsoPresetGradientType.msoGradientFog
Case "GLD" : objtemp = Office.MsoPresetGradientType.msoGradientGold
Case "GLD2" : objtemp = Office.MsoPresetGradientType.msoGradientGoldII
Case "HR" : objtemp = Office.MsoPresetGradientType.msoGradientHorizon
Case "LSS" : objtemp = Office.MsoPresetGradientType.msoGradientLateSunset
Case "MAH" : objtemp = Office.MsoPresetGradientType.msoGradientMahogany
Case "MOS" : objtemp = Office.MsoPresetGradientType.msoGradientMoss
Case "NFL" : objtemp = Office.MsoPresetGradientType.msoGradientNightfall
Case "OCN" : objtemp = Office.MsoPresetGradientType.msoGradientOcean
Case "PAR" : objtemp = Office.MsoPresetGradientType.msoGradientParchment
Case "PCK" : objtemp = Office.MsoPresetGradientType.msoGradientPeacock
Case "RNB" : objtemp = Office.MsoPresetGradientType.msoGradientRainbow
Case "RNB2" : objtemp = Office.MsoPresetGradientType.msoGradientRainbowII
Case "SAP" : objtemp = Office.MsoPresetGradientType.msoGradientSapphire
Case "SLV" : objtemp = Office.MsoPresetGradientType.msoGradientSilver
Case "WHT" : objtemp = Office.MsoPresetGradientType.msoGradientWheat
Case "MX" : objtemp = Office.MsoPresetGradientType.msoPresetGradientMixed
Case Else
Call MsgBox("Incorrect Gradient Style abbreviation : " & _
sPresetGradientStyleKey, , _
"ChartReturns_PresetGradientType")
End Select
ChartReturns_PresetGradientType = objtemp

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objtemp = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartReturns_GradientType", msMODULENAME, _
"return the corresponding preset gradient style for the abbreviation " & _
"'" & sPresetGradientStyleKey & "'.", _
gobjCOMException, gobjException)
End If
End Try
End Function

ChartReturns_PresetTextureType

public Office.MsoPresetTexture ChartReturns_PresetTextureType(string sPresetTextureTypeKey)
{
try
{
if (clsError.ErrorFlag() == true)
return;

Office.MsoPresetTexture objtemp;

switch (sPresetTextureTypeKey)
{
case "BRM":
{
objtemp = Office.MsoPresetTexture.msoTextureBrownMarble;
break;
}

case "COR":
{
objtemp = Office.MsoPresetTexture.msoTextureCork;
break;
}

case "GRN":
{
objtemp = Office.MsoPresetTexture.msoTextureGranite;
break;
}

case "GRM":
{
objtemp = Office.MsoPresetTexture.msoTextureGreenMarble;
break;
}

case "MDW":
{
objtemp = Office.MsoPresetTexture.msoTextureMediumWood;
break;
}

case "OAK":
{
objtemp = Office.MsoPresetTexture.msoTextureOak;
break;
}

case "SND":
{
objtemp = Office.MsoPresetTexture.msoTextureSand;
break;
}

case "WLN":
{
objtemp = Office.MsoPresetTexture.msoTextureWalnut;
break;
}

case "WTM":
{
objtemp = Office.MsoPresetTexture.msoTextureWhiteMarble;
break;
}

case "WMT":
{
objtemp = Office.MsoPresetTexture.msoTextureWovenMat;
break;
}

default:
{
MsgBox("Incorrect Marker Style abbreviation : " + sPresetTextureTypeKey, Title: "ChartReturns_PresetTextureType");
break;
}
}
ChartReturns_PresetTextureType = objtemp;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartReturns_PresetTextureType", msMODULENAME, "return the corresponding preset texture type for the abbreviation " + "'" + sPresetTextureTypeKey + "'.", gobjCOMException, gobjException);
}
}
Public Function ChartReturns_PresetTextureType(ByVal sPresetTextureTypeKey As String) _
As Office.MsoPresetTexture

Try
If clsError.ErrorFlag() = True Then Exit Function

Dim objtemp As Office.MsoPresetTexture

Select Case sPresetTextureTypeKey
Case "BRM" : objtemp = Office.MsoPresetTexture.msoTextureBrownMarble
Case "COR" : objtemp = Office.MsoPresetTexture.msoTextureCork
Case "GRN" : objtemp = Office.MsoPresetTexture.msoTextureGranite
Case "GRM" : objtemp = Office.MsoPresetTexture.msoTextureGreenMarble
Case "MDW" : objtemp = Office.MsoPresetTexture.msoTextureMediumWood
Case "OAK" : objtemp = Office.MsoPresetTexture.msoTextureOak
Case "SND" : objtemp = Office.MsoPresetTexture.msoTextureSand
Case "WLN" : objtemp = Office.MsoPresetTexture.msoTextureWalnut
Case "WTM" : objtemp = Office.MsoPresetTexture.msoTextureWhiteMarble
Case "WMT" : objtemp = Office.MsoPresetTexture.msoTextureWovenMat

' Case "PTM": objtemp = Microsoft.Office.Core.MsoPresetTexture.msoPresetTextureMixed
' Case "": objtemp = Microsoft.Office.Core.MsoPresetTexture.msoTextureCloth
' Case "": objtemp = Microsoft.Office.Core.MsoPresetTexture.msoTexturePaper
Case Else
Call MsgBox("Incorrect Marker Style abbreviation : " & _
sPresetTextureTypeKey, , _
"ChartReturns_PresetTextureType")

End Select
ChartReturns_PresetTextureType = objtemp

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartReturns_PresetTextureType", msMODULENAME, _
"return the corresponding preset texture type for the abbreviation " & _
"'" & sPresetTextureTypeKey & "'.", _
gobjCOMException, gobjException)
End If
End Try
End Function

ChartReturns_TickLabelOrientation

public Excel.XlTickLabelOrientation ChartReturns_TickLabelOrientation(string sTickLabelOrientationKey)
{
Excel.XlTickLabelOrientation objtemp;

try
{
if (clsError.ErrorFlag() == true)
return;

switch (sTickLabelOrientationKey)
{
case "AU":
{
objtemp = Excel.XlTickLabelOrientation.xlTickLabelOrientationAutomatic;
break;
}

case "DW":
{
objtemp = Excel.XlTickLabelOrientation.xlTickLabelOrientationDownward;
break;
}

case "HR":
{
objtemp = Excel.XlTickLabelOrientation.xlTickLabelOrientationHorizontal;
break;
}

case "AP":
{
objtemp = Excel.XlTickLabelOrientation.xlTickLabelOrientationUpward;
break;
}

case "VR":
{
objtemp = Excel.XlTickLabelOrientation.xlTickLabelOrientationVertical;
break;
}

default:
{
MsgBox("Incorrect Tick Label Orientation abbreviation : " + sTickLabelOrientationKey, Title: "ChartReturns_TickLabelOrientation");
break;
}
}
ChartReturns_TickLabelOrientation = objtemp;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objtemp = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartReturns_TickLabelOrientation", msMODULENAME, "return the corresponding tick label orientation for the abbreviation " + "'" + sTickLabelOrientationKey + "'.", gobjCOMException, gobjException);
}
}
Public Function ChartReturns_TickLabelOrientation(ByVal sTickLabelOrientationKey As String) _
As Excel.XlTickLabelOrientation

Dim objtemp As Excel.XlTickLabelOrientation

Try
If clsError.ErrorFlag() = True Then Exit Function

Select Case sTickLabelOrientationKey
Case "AU" : objtemp = Excel.XlTickLabelOrientation.xlTickLabelOrientationAutomatic
Case "DW" : objtemp = Excel.XlTickLabelOrientation.xlTickLabelOrientationDownward
Case "HR" : objtemp = Excel.XlTickLabelOrientation.xlTickLabelOrientationHorizontal
Case "AP" : objtemp = Excel.XlTickLabelOrientation.xlTickLabelOrientationUpward
Case "VR" : objtemp = Excel.XlTickLabelOrientation.xlTickLabelOrientationVertical
Case Else
Call MsgBox("Incorrect Tick Label Orientation abbreviation : " & _
sTickLabelOrientationKey, , _
"ChartReturns_TickLabelOrientation")

End Select
ChartReturns_TickLabelOrientation = objtemp

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objtemp = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartReturns_TickLabelOrientation", msMODULENAME, _
"return the corresponding tick label orientation for the abbreviation " & _
"'" & sTickLabelOrientationKey & "'.", _
gobjCOMException, gobjException)
End If
End Try
End Function

ChartReturns_TickLabelPosition

public Excel.XlTickLabelPosition ChartReturns_TickLabelPosition(string sTickLabelPositionKey)
{
Excel.XlTickLabelPosition objtemp;

try
{
if (clsError.ErrorFlag() == true)
return;

switch (sTickLabelPositionKey)
{
case "NO":
{
objtemp = Excel.XlTickLabelPosition.xlTickLabelPositionNone;
break;
}

case "LW":
{
objtemp = Excel.XlTickLabelPosition.xlTickLabelPositionLow;
break;
}

case "HI":
{
objtemp = Excel.XlTickLabelPosition.xlTickLabelPositionHigh;
break;
}

case "NA":
{
objtemp = Excel.XlTickLabelPosition.xlTickLabelPositionNextToAxis;
break;
}

default:
{
MsgBox("Incorrect Tick Label Position abbreviation : " + sTickLabelPositionKey, Title: "ChartReturns_TickLabelPosition");
break;
}
}
ChartReturns_TickLabelPosition = objtemp;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objtemp = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartReturns_TickLabelPosition", msMODULENAME, "return the corresponding tick label position for the abbreviation " + "'" + sTickLabelPositionKey + "'.", gobjCOMException, gobjException);
}
}
Public Function ChartReturns_TickLabelPosition(ByVal sTickLabelPositionKey As String) _
As Excel.XlTickLabelPosition

Dim objtemp As Excel.XlTickLabelPosition

Try
If clsError.ErrorFlag() = True Then Exit Function

Select Case sTickLabelPositionKey
Case "NO" : objtemp = Excel.XlTickLabelPosition.xlTickLabelPositionNone
Case "LW" : objtemp = Excel.XlTickLabelPosition.xlTickLabelPositionLow
Case "HI" : objtemp = Excel.XlTickLabelPosition.xlTickLabelPositionHigh
Case "NA" : objtemp = Excel.XlTickLabelPosition.xlTickLabelPositionNextToAxis
Case Else
Call MsgBox("Incorrect Tick Label Position abbreviation : " & _
sTickLabelPositionKey, , _
"ChartReturns_TickLabelPosition")

End Select
ChartReturns_TickLabelPosition = objtemp

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objtemp = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartReturns_TickLabelPosition", msMODULENAME, _
"return the corresponding tick label position for the abbreviation " & _
"'" & sTickLabelPositionKey & "'.", _
gobjCOMException, gobjException)
End If
End Try
End Function

ChartReturns_TickMarkPosition

public Excel.XlTickMark ChartReturns_TickMarkPosition(string sTickMarkPositionKey)
{
Excel.XlTickMark objtemp;

try
{
if (clsError.ErrorFlag() == true)
return;

switch (sTickMarkPositionKey)
{
case "NO":
{
objtemp = Excel.XlTickMark.xlTickMarkNone;
break;
}

case "OU":
{
objtemp = Excel.XlTickMark.xlTickMarkOutside;
break;
}

case "IN":
{
objtemp = Excel.XlTickMark.xlTickMarkInside;
break;
}

case "CR":
{
objtemp = Excel.XlTickMark.xlTickMarkCross;
break;
}

default:
{
MsgBox("Incorrect Tick Mark Position abbreviation : " + sTickMarkPositionKey, Title: "ChartReturns_TickMarkPosition");
break;
}
}
ChartReturns_TickMarkPosition = objtemp;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objtemp = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartReturns_TickMarkPosition", msMODULENAME, "return the corresponding tick mark position for the abbreviation " + "'" + sTickMarkPositionKey + "'.", gobjCOMException, gobjException);
}
}
Public Function ChartReturns_TickMarkPosition(ByVal sTickMarkPositionKey As String) _
As Excel.XlTickMark

Dim objtemp As Excel.XlTickMark

Try
If clsError.ErrorFlag() = True Then Exit Function

Select Case sTickMarkPositionKey
Case "NO" : objtemp = Excel.XlTickMark.xlTickMarkNone
Case "OU" : objtemp = Excel.XlTickMark.xlTickMarkOutside
Case "IN" : objtemp = Excel.XlTickMark.xlTickMarkInside
Case "CR" : objtemp = Excel.XlTickMark.xlTickMarkCross
Case Else
Call MsgBox("Incorrect Tick Mark Position abbreviation : " & _
sTickMarkPositionKey, , _
"ChartReturns_TickMarkPosition")
End Select
ChartReturns_TickMarkPosition = objtemp

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objtemp = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartReturns_TickMarkPosition", msMODULENAME, _
"return the corresponding tick mark position for the abbreviation " & _
"'" & sTickMarkPositionKey & "'.", _
gobjCOMException, gobjException)
End If
End Try
End Function

ChartReturns_TimeSeriesUnit

public Excel.XlTimeUnit ChartReturns_TimeSeriesUnit(string sTimeSeriesUnitKey)
{
Excel.XlTimeUnit objtemp;

try
{
if (clsError.ErrorFlag() == true)
return;

switch (sTimeSeriesUnitKey)
{
case "D":
{
objtemp = Excel.XlTimeUnit.xlDays;
break;
}

case "M":
{
objtemp = Excel.XlTimeUnit.xlMonths;
break;
}

case "Y":
{
objtemp = Excel.XlTimeUnit.xlYears;
break;
}

default:
{
MsgBox("Incorrect Time Series Base abbreviation : " + sTimeSeriesUnitKey, Title: "ChartReturns_TimeSeriesBase");
break;
}
}
ChartReturns_TimeSeriesUnit = objtemp;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objtemp = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartReturns_TimeSeriesUnit", msMODULENAME, "return the corresponding time series unit for the abbreviation " + "'" + sTimeSeriesUnitKey + "'.", gobjCOMException, gobjException);
}
}
Public Function ChartReturns_TimeSeriesUnit(ByVal sTimeSeriesUnitKey As String) _
As Excel.XlTimeUnit

Dim objtemp As Excel.XlTimeUnit

Try
If clsError.ErrorFlag() = True Then Exit Function

Select Case sTimeSeriesUnitKey
Case "D" : objtemp = Excel.XlTimeUnit.xlDays
Case "M" : objtemp = Excel.XlTimeUnit.xlMonths
Case "Y" : objtemp = Excel.XlTimeUnit.xlYears
Case Else
Call MsgBox("Incorrect Time Series Base abbreviation : " & _
sTimeSeriesUnitKey, , _
"ChartReturns_TimeSeriesBase")

End Select
ChartReturns_TimeSeriesUnit = objtemp

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objtemp = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartReturns_TimeSeriesUnit", msMODULENAME, _
"return the corresponding time series unit for the abbreviation " & _
"'" & sTimeSeriesUnitKey & "'.", _
gobjCOMException, gobjException)
End If
End Try
End Function

ChartReturns_UnderlineStyle

public Excel.XlUnderlineStyle ChartReturns_UnderlineStyle(string sUnderlineStyleKey)
{
Excel.XlUnderlineStyle objtemp;

try
{
if (clsError.ErrorFlag() == true)
return;

switch (sUnderlineStyleKey)
{
case "NO":
{
objtemp = Excel.XlUnderlineStyle.xlUnderlineStyleNone;
break;
}

case "SN":
{
objtemp = Excel.XlUnderlineStyle.xlUnderlineStyleSingle;
break;
}

case "DB":
{
objtemp = Excel.XlUnderlineStyle.xlUnderlineStyleDouble;
break;
}

default:
{
MsgBox("Incorrect Underline abbreviation : " + sUnderlineStyleKey, Title: "ChartReturns_BackgroundType");
break;
}
}
ChartReturns_UnderlineStyle = objtemp;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objtemp = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartReturns_UnderlineType", msMODULENAME, "return the corresponding underline type for the abbreviation " + "'" + sUnderlineStyleKey + "'.", gobjCOMException, gobjException);
}
}
Public Function ChartReturns_UnderlineStyle(ByVal sUnderlineStyleKey As String) _
As Excel.XlUnderlineStyle

Dim objtemp As Excel.XlUnderlineStyle

Try
If clsError.ErrorFlag() = True Then Exit Function

Select Case sUnderlineStyleKey
Case "NO" : objtemp = Excel.XlUnderlineStyle.xlUnderlineStyleNone
Case "SN" : objtemp = Excel.XlUnderlineStyle.xlUnderlineStyleSingle
Case "DB" : objtemp = Excel.XlUnderlineStyle.xlUnderlineStyleDouble
Case Else
Call MsgBox("Incorrect Underline abbreviation : " & _
sUnderlineStyleKey, , _
"ChartReturns_BackgroundType")

End Select
ChartReturns_UnderlineStyle = objtemp

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objtemp = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartReturns_UnderlineType", msMODULENAME, _
"return the corresponding underline type for the abbreviation " & _
"'" & sUnderlineStyleKey & "'.", _
gobjCOMException, gobjException)
End If
End Try
End Function

ChartSeries_AxisChange

public void ChartSeries_AxisChange(Excel.Series objSeries, string sAxisGroup)
{
try
{
if (clsError.ErrorFlag() == true)
return;

if (sAxisGroup == "P")
objSeries.AxisGroup = Excel.XlAxisGroup.xlPrimary;
if (sAxisGroup == "S")
objSeries.AxisGroup = Excel.XlAxisGroup.xlSecondary;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartSeries_AxisChange", msMODULENAME, "change the axis that series " + objSeries.Name + " is using.", gobjCOMException, gobjException);
}
}
Public Sub ChartSeries_AxisChange(ByVal objSeries As Excel.Series, _
ByVal sAxisGroup As String)

Try
If clsError.ErrorFlag() = True Then Exit Sub

If sAxisGroup = "P" Then objSeries.AxisGroup = Excel.XlAxisGroup.xlPrimary
If sAxisGroup = "S" Then objSeries.AxisGroup = Excel.XlAxisGroup.xlSecondary

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartSeries_AxisChange", msMODULENAME, _
"change the axis that series " & objSeries.Name & " is using.", _
gobjCOMException, gobjException)
End If
End Try
End Sub

ChartSeries_AxisUsed

public string ChartSeries_AxisUsed(Excel.Series objSeries)
{
try
{
if (clsError.ErrorFlag() == true)
return;

if (objSeries.AxisGroup == Excel.XlAxisGroup.xlPrimary)
ChartSeries_AxisUsed = "P";

if (objSeries.AxisGroup == Excel.XlAxisGroup.xlSecondary)
ChartSeries_AxisUsed = "S";
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartSeries_AxisUsed", msMODULENAME, "return the axis that series " + objSeries.Name + " is using.", gobjCOMException, gobjException);
}
}
Public Function ChartSeries_AxisUsed(ByVal objSeries As Excel.Series) _
As String

Try
If clsError.ErrorFlag() = True Then Exit Function

If objSeries.AxisGroup = Excel.XlAxisGroup.xlPrimary Then
ChartSeries_AxisUsed = "P"
End If

If objSeries.AxisGroup = Excel.XlAxisGroup.xlSecondary Then
ChartSeries_AxisUsed = "S"
End If

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartSeries_AxisUsed", msMODULENAME, _
"return the axis that series " & objSeries.Name & " is using.", _
gobjCOMException, gobjException)
End If
End Try
End Function

ChartSeries_Format

public void ChartSeries_Format(Excel.Chart objChart, string sFormatType, Excel.Series objSeries, int iSeriesNo)
{
try
{
if (clsError.ErrorFlag() == true)
return;

int iser;

iser = iSeriesNo;

switch (objSeries.ChartType.ToString + Space(26 - objSeries.ChartType.ToString.Length))
{
case "xlColumnClustered ":
{
ChartSeries_FormatColumn(objChart, objSeries, iser);
break;
}

case "xlColumnStacked ":
{
ChartSeries_FormatStacked(objChart, objSeries, iser);
break;
}

case "xlColumnStacked100 ":
{
ChartSeries_FormatStacked100(objChart, objSeries, iser);
break;
}

case "xl3DColumnClustered ":
{
ChartSeries_FormatColumn(objChart, objSeries, iser);
break;
}

case "xl3DColumnStacked ":
{
ChartSeries_FormatStacked(objChart, objSeries, iser);
break;
}

case "xl3DColumnStacked100 ":
{
ChartSeries_FormatStacked100(objChart, objSeries, iser);
break;
}

case "xl3DColumn ":
{
ChartSeries_FormatColumn(objChart, objSeries, iser);
break;
}

case "xlBarClustered ":
{
ChartSeries_FormatBar(objChart, objSeries, iser);
break;
}

case "xlBarStacked ":
{
ChartSeries_FormatStacked(objChart, objSeries, iser);
break;
}

case "xlBarStacked100 ":
{
ChartSeries_FormatStacked100(objChart, objSeries, iser);
break;
}

case "xl3DBarClustered ":
{
ChartSeries_FormatBar(objChart, objSeries, iser);
break;
}

case "xl3DBarStacked ":
{
ChartSeries_FormatStacked(objChart, objSeries, iser);
break;
}

case "xl3DBarStacked100 ":
{
ChartSeries_FormatStacked100(objChart, objSeries, iser);
break;
}

case "xlLine ":
{
ChartSeries_FormatLine(objChart, objSeries, iser);
break;
}

case "xlLineStacked ":
{
ChartSeries_FormatLine(objChart, objSeries, iser);
break;
}

case "xlLineStacked100 ":
{
ChartSeries_FormatStacked100(objChart, objSeries, iser);
break;
}

case "xlLineMarkers ":
{
ChartSeries_FormatLine(objChart, objSeries, iser);
break;
}

case "xlLineMarkersStacked ":
{
ChartSeries_FormatLine(objChart, objSeries, iser);
break;
}

case "xlLineMarkersStacked100 ":
{
ChartSeries_FormatStacked100(objChart, objSeries, iser);
break;
}

case "xl3DLine ":
{
ChartSeries_FormatLine(objChart, objSeries, iser);
break;
}

case "xlPie ":
{
ChartSeries_FormatPie(objChart, objSeries, iser);
break;
}

case "xlPieExploded ":
{
ChartSeries_FormatPie(objChart, objSeries, iser);
break;
}

case "xlPieOfPie ":
{
ChartSeries_FormatPie(objChart, objSeries, iser);
break;
}

case "xl3DPie ":
{
ChartSeries_FormatPie(objChart, objSeries, iser);
break;
}

case "xl3DPieExploded ":
{
ChartSeries_FormatPie(objChart, objSeries, iser);
break;
}

case "xlBarOfPie ":
{
ChartSeries_FormatBar(objChart, objSeries, iser);
break;
}

case "xlXYScatter ":
{
ChartSeries_FormatScatter(objChart, objSeries, iser);
break;
}

case "xlXYScatterLines ":
{
ChartSeries_FormatScatter(objChart, objSeries, iser);
break;
}

case "xlXYScatterLinesNoMarkers ":
{
ChartSeries_FormatScatter(objChart, objSeries, iser);
break;
}

case "xlXYScatterSmooth ":
{
ChartSeries_FormatScatter(objChart, objSeries, iser);
break;
}

case "xlXYScatterSmoothNoMarkers":
{
ChartSeries_FormatScatter(objChart, objSeries, iser);
break;
}

case "xlArea ":
{
ChartSeries_FormatArea(objChart, objSeries, iser);
break;
}

case "xlAreaStacked ":
{
ChartSeries_FormatArea(objChart, objSeries, iser);
break;
}

case "xlAreaStacked100 ":
{
ChartSeries_FormatStacked100(objChart, objSeries, iser);
break;
}

case "xl3DArea ":
{
ChartSeries_FormatArea(objChart, objSeries, iser);
break;
}

case "xl3DAreaStacked ":
{
ChartSeries_FormatArea(objChart, objSeries, iser);
break;
}

case "xl3DAreaStacked100 ":
{
ChartSeries_FormatStacked100(objChart, objSeries, iser);
break;
}

case "xlDoughnut ":
{
ChartSeries_FormatDoughnut(objChart, objSeries, iser);
break;
}

case "xlDoughnutExploded ":
{
ChartSeries_FormatDoughnut(objChart, objSeries, iser);
break;
}

case "xlRadar ":
{
ChartSeries_FormatRadar(objChart, objSeries, iser);
break;
}

case "xlRadarMarkers ":
{
ChartSeries_FormatRadar(objChart, objSeries, iser);
break;
}

case "xlRadarFilled " // : Chart_SeriesFormatRadar(objChart, objSeries, iser)
:
{
break;
}

case "xlSurface ":
{
ChartSeries_FormatScatter(objChart, objSeries, iser);
break;
}

case "xlSurfaceWireframe ":
{
ChartSeries_FormatScatter(objChart, objSeries, iser);
break;
}

case "xlSurfaceTopView ":
{
ChartSeries_FormatScatter(objChart, objSeries, iser);
break;
}

case "xlSurfaceTopViewWireframe ":
{
ChartSeries_FormatScatter(objChart, objSeries, iser);
break;
}

case "xlBubble ":
{
ChartSeries_FormatBubble(objChart, objSeries, iser);
break;
}

case "xlBubble3DEffect ":
{
ChartSeries_FormatBubble(objChart, objSeries, iser);
break;
}

case "xlStockHLC ":
{
ChartSeries_FormatStock(objChart, objSeries, iser);
break;
}

case "xlStockVHLC ":
{
ChartSeries_FormatStock(objChart, objSeries, iser);
break;
}

case "xlStockOHLC ":
{
ChartSeries_FormatStock(objChart, objSeries, iser);
break;
}

case "xlStockVOHLC ":
{
ChartSeries_FormatStock(objChart, objSeries, iser);
break;
}

case "xlCylinderCol ":
{
ChartSeries_FormatColumn(objChart, objSeries, iser);
break;
}

case "xlCylinderBarClustered ":
{
ChartSeries_FormatColumn(objChart, objSeries, iser);
break;
}

case "xlCylinderBarStacked ":
{
ChartSeries_FormatColumn(objChart, objSeries, iser);
break;
}

case "xlCylinderBarStacked100 ":
{
ChartSeries_FormatColumn(objChart, objSeries, iser);
break;
}

case "xlCylinderColClustered ":
{
ChartSeries_FormatColumn(objChart, objSeries, iser);
break;
}

case "xlCylinderColStacked ":
{
ChartSeries_FormatColumn(objChart, objSeries, iser);
break;
}

case "xlCylinderColStacked100 ":
{
ChartSeries_FormatColumn(objChart, objSeries, iser);
break;
}

case "xlConeBarClustered ":
{
ChartSeries_FormatColumn(objChart, objSeries, iser);
break;
}

case "xlConeBarStacked ":
{
ChartSeries_FormatColumn(objChart, objSeries, iser);
break;
}

case "xlConeBarStacked100 ":
{
ChartSeries_FormatColumn(objChart, objSeries, iser);
break;
}

case "xlConeCol ":
{
ChartSeries_FormatColumn(objChart, objSeries, iser);
break;
}

case "xlConeColClustered ":
{
ChartSeries_FormatColumn(objChart, objSeries, iser);
break;
}

case "xlConeColStacked ":
{
ChartSeries_FormatColumn(objChart, objSeries, iser);
break;
}

case "xlConeColStacked100 ":
{
ChartSeries_FormatColumn(objChart, objSeries, iser);
break;
}

case "xlPyramidBarClustered ":
{
ChartSeries_FormatColumn(objChart, objSeries, iser);
break;
}

case "xlPyramidBarStacked ":
{
ChartSeries_FormatColumn(objChart, objSeries, iser);
break;
}

case "xlPyramidBarStacked100 ":
{
ChartSeries_FormatColumn(objChart, objSeries, iser);
break;
}

case "xlPyramidCol ":
{
ChartSeries_FormatColumn(objChart, objSeries, iser);
break;
}

case "xlPyramidColClustered ":
{
ChartSeries_FormatColumn(objChart, objSeries, iser);
break;
}

case "xlPyramidColStacked ":
{
ChartSeries_FormatColumn(objChart, objSeries, iser);
break;
}

case "xlPyramidColStacked100 ":
{
ChartSeries_FormatColumn(objChart, objSeries, iser);
break;
}

case "-4111 ":
{
break;
}

default:
{
MsgBox(" chart type " == "" + objSeries.ChartType.ToString + "\" is not valid!");
break;
}
}
}
catch (Runtime.InteropServices.COMException objCOMException)
{
mobjCOMException = objCOMException;
}
catch (Exception objException)
{
mobjException = objException;
}

finally
{
if (gbDEBUG == true | ((IsNothing(mobjCOMException) == false | IsNothing(mobjException) == false)))
clsError.Handle("ChartType_SeriesFormat", msMODULENAME, "format series " + iSeriesNo + " which has chart type ???" + " on the active chart.", mobjCOMException, mobjException);
}
}
Public Sub ChartSeries_Format(ByVal objChart As Excel.Chart, _
ByVal sFormatType As String, _
ByVal objSeries As Excel.Series, _
ByVal iSeriesNo As Integer)


Try
If clsError.ErrorFlag() = True Then Exit Sub

Dim iser As Integer

iser = iSeriesNo

Select Case objSeries.ChartType.ToString & _
Space(26 - objSeries.ChartType.ToString.Length)

Case "xlColumnClustered " : ChartSeries_FormatColumn(objChart, objSeries, iser)
Case "xlColumnStacked " : ChartSeries_FormatStacked(objChart, objSeries, iser)
Case "xlColumnStacked100 " : ChartSeries_FormatStacked100(objChart, objSeries, iser)
Case "xl3DColumnClustered " : ChartSeries_FormatColumn(objChart, objSeries, iser)
Case "xl3DColumnStacked " : ChartSeries_FormatStacked(objChart, objSeries, iser)
Case "xl3DColumnStacked100 " : ChartSeries_FormatStacked100(objChart, objSeries, iser)
Case "xl3DColumn " : ChartSeries_FormatColumn(objChart, objSeries, iser)
'---------------------------------------------
Case "xlBarClustered " : ChartSeries_FormatBar(objChart, objSeries, iser)
Case "xlBarStacked " : ChartSeries_FormatStacked(objChart, objSeries, iser)
Case "xlBarStacked100 " : ChartSeries_FormatStacked100(objChart, objSeries, iser)
Case "xl3DBarClustered " : ChartSeries_FormatBar(objChart, objSeries, iser)
Case "xl3DBarStacked " : ChartSeries_FormatStacked(objChart, objSeries, iser)
Case "xl3DBarStacked100 " : ChartSeries_FormatStacked100(objChart, objSeries, iser)
'---------------------------------------------
Case "xlLine " : ChartSeries_FormatLine(objChart, objSeries, iser)
Case "xlLineStacked " : ChartSeries_FormatLine(objChart, objSeries, iser)
Case "xlLineStacked100 " : ChartSeries_FormatStacked100(objChart, objSeries, iser)
Case "xlLineMarkers " : ChartSeries_FormatLine(objChart, objSeries, iser)
Case "xlLineMarkersStacked " : ChartSeries_FormatLine(objChart, objSeries, iser)
Case "xlLineMarkersStacked100 " : ChartSeries_FormatStacked100(objChart, objSeries, iser)
Case "xl3DLine " : ChartSeries_FormatLine(objChart, objSeries, iser)
'---------------------------------------------
Case "xlPie " : ChartSeries_FormatPie(objChart, objSeries, iser)
Case "xlPieExploded " : ChartSeries_FormatPie(objChart, objSeries, iser)
Case "xlPieOfPie " : ChartSeries_FormatPie(objChart, objSeries, iser)
Case "xl3DPie " : ChartSeries_FormatPie(objChart, objSeries, iser)
Case "xl3DPieExploded " : ChartSeries_FormatPie(objChart, objSeries, iser)
Case "xlBarOfPie " : ChartSeries_FormatBar(objChart, objSeries, iser)
'---------------------------------------------
Case "xlXYScatter " : ChartSeries_FormatScatter(objChart, objSeries, iser)
Case "xlXYScatterLines " : ChartSeries_FormatScatter(objChart, objSeries, iser)
Case "xlXYScatterLinesNoMarkers " : ChartSeries_FormatScatter(objChart, objSeries, iser)
Case "xlXYScatterSmooth " : ChartSeries_FormatScatter(objChart, objSeries, iser)
Case "xlXYScatterSmoothNoMarkers" : ChartSeries_FormatScatter(objChart, objSeries, iser)
'---------------------------------------------
Case "xlArea " : ChartSeries_FormatArea(objChart, objSeries, iser)
Case "xlAreaStacked " : ChartSeries_FormatArea(objChart, objSeries, iser)
Case "xlAreaStacked100 " : ChartSeries_FormatStacked100(objChart, objSeries, iser)
Case "xl3DArea " : ChartSeries_FormatArea(objChart, objSeries, iser)
Case "xl3DAreaStacked " : ChartSeries_FormatArea(objChart, objSeries, iser)
Case "xl3DAreaStacked100 " : ChartSeries_FormatStacked100(objChart, objSeries, iser)
'---------------------------------------------
Case "xlDoughnut " : ChartSeries_FormatDoughnut(objChart, objSeries, iser)
Case "xlDoughnutExploded " : ChartSeries_FormatDoughnut(objChart, objSeries, iser)
'---------------------------------------------
Case "xlRadar " : ChartSeries_FormatRadar(objChart, objSeries, iser)
Case "xlRadarMarkers " : ChartSeries_FormatRadar(objChart, objSeries, iser)

'xlRadarFilled - is nto recognised - -4111 ??
Case "xlRadarFilled " ': Chart_SeriesFormatRadar(objChart, objSeries, iser)
'---------------------------------------------
Case "xlSurface " : ChartSeries_FormatScatter(objChart, objSeries, iser)
Case "xlSurfaceWireframe " : ChartSeries_FormatScatter(objChart, objSeries, iser)
Case "xlSurfaceTopView " : ChartSeries_FormatScatter(objChart, objSeries, iser)
Case "xlSurfaceTopViewWireframe " : ChartSeries_FormatScatter(objChart, objSeries, iser)
'---------------------------------------------
Case "xlBubble " : ChartSeries_FormatBubble(objChart, objSeries, iser)
Case "xlBubble3DEffect " : ChartSeries_FormatBubble(objChart, objSeries, iser)
'---------------------------------------------
Case "xlStockHLC " : ChartSeries_FormatStock(objChart, objSeries, iser)
Case "xlStockVHLC " : ChartSeries_FormatStock(objChart, objSeries, iser)
Case "xlStockOHLC " : ChartSeries_FormatStock(objChart, objSeries, iser)
Case "xlStockVOHLC " : ChartSeries_FormatStock(objChart, objSeries, iser)
'---------------------------------------------
Case "xlCylinderCol " : ChartSeries_FormatColumn(objChart, objSeries, iser)
Case "xlCylinderBarClustered " : ChartSeries_FormatColumn(objChart, objSeries, iser)
Case "xlCylinderBarStacked " : ChartSeries_FormatColumn(objChart, objSeries, iser)
Case "xlCylinderBarStacked100 " : ChartSeries_FormatColumn(objChart, objSeries, iser)
Case "xlCylinderColClustered " : ChartSeries_FormatColumn(objChart, objSeries, iser)
Case "xlCylinderColStacked " : ChartSeries_FormatColumn(objChart, objSeries, iser)
Case "xlCylinderColStacked100 " : ChartSeries_FormatColumn(objChart, objSeries, iser)
'---------------------------------------------
Case "xlConeBarClustered " : ChartSeries_FormatColumn(objChart, objSeries, iser)
Case "xlConeBarStacked " : ChartSeries_FormatColumn(objChart, objSeries, iser)
Case "xlConeBarStacked100 " : ChartSeries_FormatColumn(objChart, objSeries, iser)
Case "xlConeCol " : ChartSeries_FormatColumn(objChart, objSeries, iser)
Case "xlConeColClustered " : ChartSeries_FormatColumn(objChart, objSeries, iser)
Case "xlConeColStacked " : ChartSeries_FormatColumn(objChart, objSeries, iser)
Case "xlConeColStacked100 " : ChartSeries_FormatColumn(objChart, objSeries, iser)
'---------------------------------------------
Case "xlPyramidBarClustered " : ChartSeries_FormatColumn(objChart, objSeries, iser)
Case "xlPyramidBarStacked " : ChartSeries_FormatColumn(objChart, objSeries, iser)
Case "xlPyramidBarStacked100 " : ChartSeries_FormatColumn(objChart, objSeries, iser)
Case "xlPyramidCol " : ChartSeries_FormatColumn(objChart, objSeries, iser)
Case "xlPyramidColClustered " : ChartSeries_FormatColumn(objChart, objSeries, iser)
Case "xlPyramidColStacked " : ChartSeries_FormatColumn(objChart, objSeries, iser)
Case "xlPyramidColStacked100 " : ChartSeries_FormatColumn(objChart, objSeries, iser)
'---------------------------------------------
Case "-4111 "
'This also occurs when you get the chart type of a "xlRadarFilled"
'This occurs if you try and get the type of a series on a Stock chart
'---------------------------------------------

'Case xlBar : Call Chart_SeriesFormatColumn(idef, iser)
'Case xl3DBar : Call Chart_SeriesFormatBar(idef, iser)
'Case xlCylinder : Call Chart_SeriesFormatColumn(idef, iser)
Case Else
Call MsgBox( _
" chart type " = "" & objSeries.ChartType.ToString & """ is not valid!")
End Select

Catch objCOMException As System.Runtime.InteropServices.COMException
mobjCOMException = objCOMException
Catch objException As Exception
mobjException = objException

Finally
If gbDEBUG = True Or _
((IsNothing(mobjCOMException) = False Or IsNothing(mobjException) = False)) Then

Call clsError.Handle("ChartType_SeriesFormat", msMODULENAME, _
"format series " & iSeriesNo & " which has chart type ???" & _
" on the active chart.", _
mobjCOMException, mobjException)
End If
End Try
End Sub

ChartSeries_Format_LineOrArea

public void ChartSeries_Format_LineOrArea(Excel.Chart objChart, Excel.Series objSeries, int iSeriesNo)
{
try
{
if (clsError.ErrorFlag() == true)
return;

int iser;

iser = iSeriesNo;

switch (objSeries.ChartType.ToString + Space(26 - objSeries.ChartType.ToString.Length))
{
case "xlColumnClustered ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlColumnStacked ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlColumnStacked100 ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xl3DColumnClustered ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xl3DColumnStacked ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xl3DColumnStacked100 ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xl3DColumn ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlBarClustered ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlBarStacked ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlBarStacked100 ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xl3DBarClustered ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xl3DBarStacked ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xl3DBarStacked100 ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlLine ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlLineStacked ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlLineStacked100 ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlLineMarkers ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlLineMarkersStacked ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlLineMarkersStacked100 ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xl3DLine ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlPie ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlPieExploded ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlPieOfPie ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xl3DPie ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xl3DPieExploded ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlBarOfPie ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlXYScatter ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlXYScatterLines ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlXYScatterLinesNoMarkers ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlXYScatterSmooth ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlXYScatterSmoothNoMarkers":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlArea ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlAreaStacked ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlAreaStacked100 ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xl3DArea ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xl3DAreaStacked ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xl3DAreaStacked100 ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlDoughnut ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlDoughnutExploded ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlRadar ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlRadarMarkers ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlRadarFilled ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlSurface " // : Chart_SeriesAreaFormat(objChart, objSeries, iser)
:
{
break;
}

case "xlSurfaceWireframe " // : Chart_SeriesLineFormat(objChart, objSeries, iser)
:
{
break;
}

case "xlSurfaceTopView " // : Chart_SeriesAreaFormat(objChart, objSeries, iser)
:
{
break;
}

case "xlSurfaceTopViewWireframe " // : Chart_SeriesLineFormat(objChart, objSeries, iser)
:
{
break;
}

case "xlBubble ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlBubble3DEffect ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlStockHLC ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlStockVHLC ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlStockOHLC ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlStockVOHLC ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlCylinderCol ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlCylinderBarClustered ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlCylinderBarStacked ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlCylinderBarStacked100 ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlCylinderColClustered ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlCylinderColStacked ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlCylinderColStacked100 ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlConeBarClustered ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlConeBarStacked ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlConeBarStacked100 ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlConeCol ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlConeColClustered ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlConeColStacked ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlConeColStacked100 ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlPyramidBarClustered ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlPyramidBarStacked ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlPyramidBarStacked100 ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlPyramidCol ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlPyramidColClustered ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlPyramidColStacked ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "xlPyramidColStacked100 ":
{
ChartFormat_SeriesArea(objChart, objSeries, iser);
break;
}

case "-4111 ":
{
break;
}

default:
{
MsgBox(" chart type '" + objSeries.ChartType.ToString + "' is not valid !");
break;
}
}
}
catch (Runtime.InteropServices.COMException objCOMException)
{
mobjCOMException = objCOMException;
}
catch (Exception objException)
{
mobjException = objException;
}

finally
{
objChart = null/* TODO Change to default(_) if this is not a reference type */;
objSeries = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(mobjCOMException) == false | IsNothing(mobjException) == false)))
clsError.Handle("ChartType_SeriesFormatLineOrArea", msMODULENAME, "format series " + iSeriesNo + " which has chart type " + objSeries.ChartType.ToString + " on the active chart.", mobjCOMException, mobjException);
}
}
Public Sub ChartSeries_Format_LineOrArea(ByVal objChart As Excel.Chart, _
ByVal objSeries As Excel.Series, _
ByVal iSeriesNo As Integer)

Try
If clsError.ErrorFlag() = True Then Exit Sub

Dim iser As Integer

iser = iSeriesNo

Select Case objSeries.ChartType.ToString & _
Space(26 - objSeries.ChartType.ToString.Length)

Case "xlColumnClustered " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlColumnStacked " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlColumnStacked100 " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xl3DColumnClustered " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xl3DColumnStacked " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xl3DColumnStacked100 " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xl3DColumn " : ChartFormat_SeriesArea(objChart, objSeries, iser)
'---------------------------------------------
Case "xlBarClustered " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlBarStacked " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlBarStacked100 " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xl3DBarClustered " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xl3DBarStacked " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xl3DBarStacked100 " : ChartFormat_SeriesArea(objChart, objSeries, iser)
'---------------------------------------------
Case "xlLine " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlLineStacked " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlLineStacked100 " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlLineMarkers " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlLineMarkersStacked " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlLineMarkersStacked100 " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xl3DLine " : ChartFormat_SeriesArea(objChart, objSeries, iser)
'---------------------------------------------
Case "xlPie " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlPieExploded " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlPieOfPie " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xl3DPie " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xl3DPieExploded " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlBarOfPie " : ChartFormat_SeriesArea(objChart, objSeries, iser)
'---------------------------------------------
Case "xlXYScatter " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlXYScatterLines " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlXYScatterLinesNoMarkers " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlXYScatterSmooth " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlXYScatterSmoothNoMarkers" : ChartFormat_SeriesArea(objChart, objSeries, iser)
'---------------------------------------------
Case "xlArea " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlAreaStacked " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlAreaStacked100 " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xl3DArea " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xl3DAreaStacked " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xl3DAreaStacked100 " : ChartFormat_SeriesArea(objChart, objSeries, iser)
'---------------------------------------------
Case "xlDoughnut " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlDoughnutExploded " : ChartFormat_SeriesArea(objChart, objSeries, iser)
'---------------------------------------------
Case "xlRadar " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlRadarMarkers " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlRadarFilled " : ChartFormat_SeriesArea(objChart, objSeries, iser)
'---------------------------------------------
'This is not possible ???
Case "xlSurface " ': Chart_SeriesAreaFormat(objChart, objSeries, iser)
Case "xlSurfaceWireframe " ': Chart_SeriesLineFormat(objChart, objSeries, iser)
Case "xlSurfaceTopView " ': Chart_SeriesAreaFormat(objChart, objSeries, iser)
Case "xlSurfaceTopViewWireframe " ': Chart_SeriesLineFormat(objChart, objSeries, iser)
'---------------------------------------------
Case "xlBubble " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlBubble3DEffect " : ChartFormat_SeriesArea(objChart, objSeries, iser)
'---------------------------------------------
Case "xlStockHLC " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlStockVHLC " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlStockOHLC " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlStockVOHLC " : ChartFormat_SeriesArea(objChart, objSeries, iser)
'---------------------------------------------
Case "xlCylinderCol " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlCylinderBarClustered " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlCylinderBarStacked " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlCylinderBarStacked100 " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlCylinderColClustered " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlCylinderColStacked " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlCylinderColStacked100 " : ChartFormat_SeriesArea(objChart, objSeries, iser)
'---------------------------------------------
Case "xlConeBarClustered " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlConeBarStacked " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlConeBarStacked100 " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlConeCol " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlConeColClustered " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlConeColStacked " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlConeColStacked100 " : ChartFormat_SeriesArea(objChart, objSeries, iser)
'---------------------------------------------
Case "xlPyramidBarClustered " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlPyramidBarStacked " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlPyramidBarStacked100 " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlPyramidCol " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlPyramidColClustered " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlPyramidColStacked " : ChartFormat_SeriesArea(objChart, objSeries, iser)
Case "xlPyramidColStacked100 " : ChartFormat_SeriesArea(objChart, objSeries, iser)
'---------------------------------------------
Case "-4111 "
'---------------------------------------------

Case Else
Call MsgBox( _
" chart type '" & objSeries.ChartType.ToString & "' is not valid !")
End Select

Catch objCOMException As System.Runtime.InteropServices.COMException
mobjCOMException = objCOMException
Catch objException As Exception
mobjException = objException

Finally
objChart = Nothing
objSeries = Nothing

If gbDEBUG = True Or _
((IsNothing(mobjCOMException) = False Or IsNothing(mobjException) = False)) Then

Call clsError.Handle("ChartType_SeriesFormatLineOrArea", msMODULENAME, _
"format series " & iSeriesNo & " which has chart type " & _
objSeries.ChartType.ToString & _
" on the active chart.", _
mobjCOMException, mobjException)
End If
End Try
End Sub

ChartSeries_Format3D

public void ChartSeries_Format3D(Excel.Chart objChart, Excel.Series objSeries, int iSeriesNo)
{
try
{
if (clsError.ErrorFlag() == true)
return;
}

// With objChart
// .Elevation = 15
// .Rotation = 20
// End With

// if its a 3D bar chart then
// can specify the bar shape
// .BarShape = Return_3DBarShape("")

// call format_flooroptions
// call format_wallsoptions


catch (Runtime.InteropServices.COMException objCOMException)
{
mobjCOMException = objCOMException;
}
catch (Exception objException)
{
mobjException = objException;
}

finally
{
objChart = null/* TODO Change to default(_) if this is not a reference type */;
objSeries = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(mobjCOMException) == false | IsNothing(mobjException) == false)))
clsError.Handle("ChartSeries_Format3D", msMODULENAME, "apply the customised '3D' formatting to the active chart.", mobjCOMException, mobjException);
}
}
Public Sub ChartSeries_Format3D(ByVal objChart As Excel.Chart, _
ByVal objSeries As Excel.Series, _
ByVal iSeriesNo As Integer)

Try
If clsError.ErrorFlag() = True Then Exit Sub

'With objChart
' .Elevation = 15
' .Rotation = 20
'End With

'if its a 3D bar chart then
'can specify the bar shape
' .BarShape = Return_3DBarShape("")

'call format_flooroptions
'call format_wallsoptions


Catch objCOMException As System.Runtime.InteropServices.COMException
mobjCOMException = objCOMException
Catch objException As Exception
mobjException = objException

Finally
objChart = Nothing
objSeries = Nothing

If gbDEBUG = True Or _
((IsNothing(mobjCOMException) = False Or IsNothing(mobjException) = False)) Then

Call clsError.Handle("ChartSeries_Format3D", msMODULENAME, _
"apply the customised '3D' formatting to the active chart.", _
mobjCOMException, mobjException)
End If
End Try
End Sub

ChartSeries_FormatArea

public void ChartSeries_FormatArea(Excel.Chart objChart, Excel.Series objSeries, int iSeriesNo)
{
try
{
if (clsError.ErrorFlag() == true)
return;

{
var withBlock = objSeries;
withBlock.ApplyDataLabels(Excel.XlDataLabelsType.xlDataLabelsShowNone);
}
}
catch (Runtime.InteropServices.COMException objCOMException)
{
mobjCOMException = objCOMException;
}
catch (Exception objException)
{
mobjException = objException;
}

finally
{
if (gbDEBUG == true | ((IsNothing(mobjCOMException) == false | IsNothing(mobjException) == false)))
clsError.Handle("ChartSeries_FormatArea", msMODULENAME, "apply the customised 'Area' formatting to the active chart.", mobjCOMException, mobjException);
}
}
Public Sub ChartSeries_FormatArea(ByVal objChart As Excel.Chart, _
ByVal objSeries As Excel.Series, _
ByVal iSeriesNo As Integer)

Try
If clsError.ErrorFlag() = True Then Exit Sub

With objSeries
.ApplyDataLabels(Excel.XlDataLabelsType.xlDataLabelsShowNone)


End With

Catch objCOMException As System.Runtime.InteropServices.COMException
mobjCOMException = objCOMException
Catch objException As Exception
mobjException = objException

Finally
If gbDEBUG = True Or _
((IsNothing(mobjCOMException) = False Or IsNothing(mobjException) = False)) Then

Call clsError.Handle("ChartSeries_FormatArea", msMODULENAME, _
"apply the customised 'Area' formatting to the active chart.", _
mobjCOMException, mobjException)
End If
End Try
End Sub

ChartSeries_FormatBar

public void ChartSeries_FormatBar(Excel.Chart objChart, Excel.Series objSeries, int iSeriesNo, int iGapWidth = 100, bool bHasSeriesLine = false, bool bShadow = false, int iOverlapWidth = 0, bool bVaryByCategories = false, int iChartDepth = 150, int iGapDepth = 100)
{
Excel.ChartGroup objChartGroup;

try
{
if (clsError.ErrorFlag() == true)
return;

{
var withBlock = objSeries;
withBlock.Shadow = bShadow;

withBlock.ApplyDataLabels(Excel.XlDataLabelsType.xlDataLabelsShowNone);

objChartGroup = (Excel.ChartGroup)objChart.ChartGroups(1);
{
var withBlock1 = objChartGroup;
withBlock1.Overlap = iOverlapWidth;
withBlock1.GapWidth = iGapWidth;
withBlock1.HasSeriesLines = bHasSeriesLine;
withBlock1.VaryByCategories = bVaryByCategories;
}
}

if (ChartType_SeriesTypeIsIt3D(objSeries) == true)
ChartSeries_Format3D(objChart, objSeries, iSeriesNo);
}
catch (Runtime.InteropServices.COMException objCOMException)
{
mobjCOMException = objCOMException;
}
catch (Exception objException)
{
mobjException = objException;
}

finally
{
objChart = null/* TODO Change to default(_) if this is not a reference type */;
objSeries = null/* TODO Change to default(_) if this is not a reference type */;
objChartGroup = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(mobjCOMException) == false | IsNothing(mobjException) == false)))
clsError.Handle("ChartSeries_FormatBar", msMODULENAME, "apply the customised 'Bar' formatting to the active chart.", mobjCOMException, mobjException);
}
}
Public Sub ChartSeries_FormatBar(ByVal objChart As Excel.Chart, _
ByVal objSeries As Excel.Series, _
ByVal iSeriesNo As Integer, _
Optional ByVal iGapWidth As Integer = 100, _
Optional ByVal bHasSeriesLine As Boolean = False, _
Optional ByVal bShadow As Boolean = False, _
Optional ByVal iOverlapWidth As Integer = 0, _
Optional ByVal bVaryByCategories As Boolean = False, _
Optional ByVal iChartDepth As Integer = 150, _
Optional ByVal iGapDepth As Integer = 100)

Dim objChartGroup As Excel.ChartGroup

Try
If clsError.ErrorFlag() = True Then Exit Sub

With objSeries
.Shadow = bShadow

.ApplyDataLabels(Excel.XlDataLabelsType.xlDataLabelsShowNone)

objChartGroup = CType(objChart.ChartGroups(1), Excel.ChartGroup)
With objChartGroup
.Overlap = iOverlapWidth
.GapWidth = iGapWidth
.HasSeriesLines = bHasSeriesLine
.VaryByCategories = bVaryByCategories
End With

End With

If ChartType_SeriesTypeIsIt3D(objSeries) = True Then _
Call ChartSeries_Format3D(objChart, objSeries, iSeriesNo)

Catch objCOMException As System.Runtime.InteropServices.COMException
mobjCOMException = objCOMException
Catch objException As Exception
mobjException = objException

Finally
objChart = Nothing
objSeries = Nothing
objChartGroup = Nothing

If gbDEBUG = True Or _
((IsNothing(mobjCOMException) = False Or IsNothing(mobjException) = False)) Then

Call clsError.Handle("ChartSeries_FormatBar", msMODULENAME, _
"apply the customised 'Bar' formatting to the active chart.", _
mobjCOMException, mobjException)
End If
End Try
End Sub

ChartSeries_FormatBubble

public void ChartSeries_FormatBubble(Excel.Chart objChart, Excel.Series objSeries, int iSeriesNo, int iBorderColour = 0, int iBorderWeight = 1, string sBorderLineStyle = "NO", int iInteriorColourIdx = 0, bool bHas3DEffect = true)
{
Excel.ChartGroup objChartGroup;

try
{
if (clsError.ErrorFlag() == true)
return;

if (objChart.HasLegend == true)
objChart.Legend.Delete();

{
var withBlock = objSeries;
withBlock.Border.Color = iBorderColour;
withBlock.Border.Weight = ChartReturns_BorderWeight(iBorderWeight);
withBlock.Border.LineStyle = ChartReturns_LineStyle(sBorderLineStyle);

objChartGroup = (Excel.ChartGroup)objChart.ChartGroups(1);
{
var withBlock1 = objChartGroup;
withBlock1.ShowNegativeBubbles = false;
withBlock1.SizeRepresents = Excel.XlSizeRepresents.xlSizeIsArea;
withBlock1.BubbleScale = 100;
}
withBlock.Has3DEffect = bHas3DEffect; // is negative - greyed out
}
}

// '.ErrorBar Direction:=xlX, Include:=xlMinusValues, Type:=xlFixedValue, Amount:=5

catch (Runtime.InteropServices.COMException objCOMException)
{
mobjCOMException = objCOMException;
}
catch (Exception objException)
{
mobjException = objException;
}

finally
{
objChart = null/* TODO Change to default(_) if this is not a reference type */;
objSeries = null/* TODO Change to default(_) if this is not a reference type */;
objChartGroup = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(mobjCOMException) == false | IsNothing(mobjException) == false)))
clsError.Handle("ChartSeries_FormatBubble", msMODULENAME, "apply the customised 'Bubble' formatting to the active chart.", mobjCOMException, mobjException);
}
}
Public Sub ChartSeries_FormatBubble(ByVal objChart As Excel.Chart, _
ByVal objSeries As Excel.Series, _
ByVal iSeriesNo As Integer, _
Optional ByVal iBorderColour As Integer = 0, _
Optional ByVal iBorderWeight As Integer = 1, _
Optional ByVal sBorderLineStyle As String = "NO", _
Optional ByVal iInteriorColourIdx As Integer = 0, _
Optional ByVal bHas3DEffect As Boolean = True)

Dim objChartGroup As Excel.ChartGroup

Try
If clsError.ErrorFlag() = True Then Exit Sub

If objChart.HasLegend = True Then objChart.Legend.Delete()

With objSeries
.Border.Color = iBorderColour
.Border.Weight = ChartReturns_BorderWeight(iBorderWeight)
.Border.LineStyle = ChartReturns_LineStyle(sBorderLineStyle)

objChartGroup = CType(objChart.ChartGroups(1), Excel.ChartGroup)
With objChartGroup
.ShowNegativeBubbles = False
.SizeRepresents = Excel.XlSizeRepresents.xlSizeIsArea
.BubbleScale = 100
End With
.Has3DEffect = bHas3DEffect 'is negative - greyed out

End With

' '.ErrorBar Direction:=xlX, Include:=xlMinusValues, Type:=xlFixedValue, Amount:=5

Catch objCOMException As System.Runtime.InteropServices.COMException
mobjCOMException = objCOMException
Catch objException As Exception
mobjException = objException

Finally
objChart = Nothing
objSeries = Nothing
objChartGroup = Nothing

If gbDEBUG = True Or _
((IsNothing(mobjCOMException) = False Or IsNothing(mobjException) = False)) Then

Call clsError.Handle("ChartSeries_FormatBubble", msMODULENAME, _
"apply the customised 'Bubble' formatting to the active chart.", _
mobjCOMException, mobjException)
End If
End Try
End Sub

ChartSeries_FormatClustered

public void ChartSeries_FormatClustered(Excel.Chart objChart, Excel.Series objSeries, int iSeriesNo)
{
try
{
if (clsError.ErrorFlag() == true)
return;
}

catch (Runtime.InteropServices.COMException objCOMException)
{
mobjCOMException = objCOMException;
}
catch (Exception objException)
{
mobjException = objException;
}

finally
{
objChart = null/* TODO Change to default(_) if this is not a reference type */;
objSeries = null/* TODO Change to default(_) if this is not a reference type */;
if (gbDEBUG == true | ((IsNothing(mobjCOMException) == false | IsNothing(mobjException) == false)))
clsError.Handle("ChartSeries_FormatClustered", msMODULENAME, "apply the customised 'Clustered' formatting to the active chart.", mobjCOMException, mobjException);
}
}
Public Sub ChartSeries_FormatClustered(ByVal objChart As Excel.Chart, _
ByVal objSeries As Excel.Series, _
ByVal iSeriesNo As Integer)

Try
If clsError.ErrorFlag() = True Then Exit Sub


Catch objCOMException As System.Runtime.InteropServices.COMException
mobjCOMException = objCOMException
Catch objException As Exception
mobjException = objException

Finally
objChart = Nothing
objSeries = Nothing
If gbDEBUG = True Or _
((IsNothing(mobjCOMException) = False Or IsNothing(mobjException) = False)) Then

Call clsError.Handle("ChartSeries_FormatClustered", msMODULENAME, _
"apply the customised 'Clustered' formatting to the active chart.", _
mobjCOMException, mobjException)
End If
End Try
End Sub

ChartSeries_FormatColumn

public void ChartSeries_FormatColumn(Excel.Chart objChart, Excel.Series objSeries, int iSeriesNo, int iBorderColourIdx = giDEF_PALETTEAXESCOLOUR, int iBorderWeight = 1, string sBorderLineStyle = "NO", int iGapWidth = 100, bool bHasSeriesLine = false, bool bShadow = false, int iOverlapWidth = 0, bool bVaryByCategories = false, int iChartDepth = 150, int iGapDepth = 100)
{
Excel.ChartGroup objChartGroup;

try
{
if (clsError.ErrorFlag() == true)
return;

{
var withBlock = objSeries;
// .Border.Color = iBorderColour
withBlock.Border.ColorIndex = iBorderColourIdx;
withBlock.Border.Weight = ChartReturns_BorderWeight(iBorderWeight);
withBlock.Border.LineStyle = ChartReturns_LineStyle(sBorderLineStyle);

withBlock.Shadow = bShadow;

withBlock.ApplyDataLabels(Excel.XlDataLabelsType.xlDataLabelsShowNone);

objChartGroup = (Excel.ChartGroup)objChart.ChartGroups(1);
{
var withBlock1 = objChartGroup;
withBlock1.Overlap = iOverlapWidth;
withBlock1.GapWidth = iGapWidth;
withBlock1.HasSeriesLines = bHasSeriesLine;
withBlock1.VaryByCategories = bVaryByCategories;
}
}
}
catch (Runtime.InteropServices.COMException objCOMException)
{
mobjCOMException = objCOMException;
}
catch (Exception objException)
{
mobjException = objException;
}

finally
{
objChart = null/* TODO Change to default(_) if this is not a reference type */;
objSeries = null/* TODO Change to default(_) if this is not a reference type */;
objChartGroup = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(mobjCOMException) == false | IsNothing(mobjException) == false)))
clsError.Handle("ChartSeries_FormatColumn", msMODULENAME, "apply the customised 'Column' formatting to the active chart.", mobjCOMException, mobjException);
}
}
Public Sub ChartSeries_FormatColumn(ByVal objChart As Excel.Chart, _
ByVal objSeries As Excel.Series, _
ByVal iSeriesNo As Integer, _
Optional ByVal iBorderColourIdx As Integer = giDEF_PALETTEAXESCOLOUR, _
Optional ByVal iBorderWeight As Integer = 1, _
Optional ByVal sBorderLineStyle As String = "NO", _
Optional ByVal iGapWidth As Integer = 100, _
Optional ByVal bHasSeriesLine As Boolean = False, _
Optional ByVal bShadow As Boolean = False, _
Optional ByVal iOverlapWidth As Integer = 0, _
Optional ByVal bVaryByCategories As Boolean = False, _
Optional ByVal iChartDepth As Integer = 150, _
Optional ByVal iGapDepth As Integer = 100)

Dim objChartGroup As Excel.ChartGroup

Try
If clsError.ErrorFlag() = True Then Exit Sub

With objSeries
'.Border.Color = iBorderColour
.Border.ColorIndex = iBorderColourIdx
.Border.Weight = ChartReturns_BorderWeight(iBorderWeight)
.Border.LineStyle = ChartReturns_LineStyle(sBorderLineStyle)

.Shadow = bShadow

.ApplyDataLabels(Excel.XlDataLabelsType.xlDataLabelsShowNone)

objChartGroup = CType(objChart.ChartGroups(1), Excel.ChartGroup)
With objChartGroup
.Overlap = iOverlapWidth
.GapWidth = iGapWidth
.HasSeriesLines = bHasSeriesLine
.VaryByCategories = bVaryByCategories
End With

End With

Catch objCOMException As System.Runtime.InteropServices.COMException
mobjCOMException = objCOMException
Catch objException As Exception
mobjException = objException

Finally
objChart = Nothing
objSeries = Nothing
objChartGroup = Nothing

If gbDEBUG = True Or _
((IsNothing(mobjCOMException) = False Or IsNothing(mobjException) = False)) Then

Call clsError.Handle("ChartSeries_FormatColumn", msMODULENAME, _
"apply the customised 'Column' formatting to the active chart.", _
mobjCOMException, mobjException)
End If
End Try
End Sub

ChartSeries_FormatCone

public void ChartSeries_FormatCone(Excel.Chart objChart, Excel.Series objSeries, int iSeriesNo)
{
try
{
if (clsError.ErrorFlag() == true)
return;
}

catch (Runtime.InteropServices.COMException objCOMException)
{
mobjCOMException = objCOMException;
}
catch (Exception objException)
{
mobjException = objException;
}

finally
{
objChart = null/* TODO Change to default(_) if this is not a reference type */;
objSeries = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(mobjCOMException) == false | IsNothing(mobjException) == false)))
clsError.Handle("ChartSeries_FormatCone", msMODULENAME, "apply the customised 'Cone' formatting to the active chart.", mobjCOMException, mobjException);
}
}
Public Sub ChartSeries_FormatCone(ByVal objChart As Excel.Chart, _
ByVal objSeries As Excel.Series, _
ByVal iSeriesNo As Integer)

Try
If clsError.ErrorFlag() = True Then Exit Sub


Catch objCOMException As System.Runtime.InteropServices.COMException
mobjCOMException = objCOMException
Catch objException As Exception
mobjException = objException

Finally
objChart = Nothing
objSeries = Nothing

If gbDEBUG = True Or _
((IsNothing(mobjCOMException) = False Or IsNothing(mobjException) = False)) Then

Call clsError.Handle("ChartSeries_FormatCone", msMODULENAME, _
"apply the customised 'Cone' formatting to the active chart.", _
mobjCOMException, mobjException)
End If
End Try
End Sub

ChartSeries_FormatCylinder

public void ChartSeries_FormatCylinder(Excel.Chart objChart, Excel.Series objSeries, int iSeriesNo)
{
try
{
if (clsError.ErrorFlag() == true)
return;
}

catch (Runtime.InteropServices.COMException objCOMException)
{
mobjCOMException = objCOMException;
}
catch (Exception objException)
{
mobjException = objException;
}

finally
{
objChart = null/* TODO Change to default(_) if this is not a reference type */;
objSeries = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(mobjCOMException) == false | IsNothing(mobjException) == false)))
clsError.Handle("ChartSeries_FormatCylinder", msMODULENAME, "apply the customised 'Cylinder' formatting to the active chart.", mobjCOMException, mobjException);
}
}
Public Sub ChartSeries_FormatCylinder(ByVal objChart As Excel.Chart, _
ByVal objSeries As Excel.Series, _
ByVal iSeriesNo As Integer)

Try
If clsError.ErrorFlag() = True Then Exit Sub


Catch objCOMException As System.Runtime.InteropServices.COMException
mobjCOMException = objCOMException
Catch objException As Exception
mobjException = objException

Finally
objChart = Nothing
objSeries = Nothing

If gbDEBUG = True Or _
((IsNothing(mobjCOMException) = False Or IsNothing(mobjException) = False)) Then

Call clsError.Handle("ChartSeries_FormatCylinder", msMODULENAME, _
"apply the customised 'Cylinder' formatting to the active chart.", _
mobjCOMException, mobjException)
End If
End Try
End Sub

ChartSeries_FormatDoughnut

public void ChartSeries_FormatDoughnut(Excel.Chart objChart, Excel.Series objSeries, int iSeriesNo)
{
Excel.ChartArea objChartArea;

try
{
if (clsError.ErrorFlag() == true)
return;

float sngchartwidth;
float sngchartheight;
string ssmallestside;
int ismallestlength;
int idivisionlength;


objChartArea = objChart.ChartArea;

// ----------------- sizing the pie chart to the correct size and centering
{
var withBlock = objChart;
if (objChartArea.Width <= objChartArea.Height)
{
ismallestlength = System.Convert.ToInt32(objChartArea.Width);
ssmallestside = "W";
}
if (objChartArea.Height < objChartArea.Width)
{
ismallestlength = System.Convert.ToInt32(objChartArea.Height);
ssmallestside = "H";
}
idivisionlength = System.Convert.ToInt32(ismallestlength / (double)6);
withBlock.PlotArea.Width = idivisionlength * 4;

if (ssmallestside == "H")
{
withBlock.PlotArea.Top = idivisionlength;
withBlock.PlotArea.Left = (withBlock.ChartArea.Width - withBlock.ChartArea.Height) / (double)2;
withBlock.PlotArea.Left = withBlock.PlotArea.Left + idivisionlength;
}

if (ssmallestside == "W")
{
withBlock.PlotArea.Left = idivisionlength;
withBlock.PlotArea.Top = (withBlock.ChartArea.Height - withBlock.ChartArea.Width) / (double)2;
withBlock.PlotArea.Top = withBlock.PlotArea.Top + idivisionlength;
}
}
}
// ----------------------------


catch (Runtime.InteropServices.COMException objCOMException)
{
mobjCOMException = objCOMException;
}
catch (Exception objException)
{
mobjException = objException;
}

finally
{
objChart = null/* TODO Change to default(_) if this is not a reference type */;
objSeries = null/* TODO Change to default(_) if this is not a reference type */;
objChartArea = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(mobjCOMException) == false | IsNothing(mobjException) == false)))
clsError.Handle("ChartSeries_FormatDoughnut", msMODULENAME, "apply the customised 'Doughnut' formatting to the active chart.", mobjCOMException, mobjException);
}
}
Public Sub ChartSeries_FormatDoughnut(ByVal objChart As Excel.Chart, _
ByVal objSeries As Excel.Series, _
ByVal iSeriesNo As Integer)

Dim objChartArea As Excel.ChartArea

Try
If clsError.ErrorFlag() = True Then Exit Sub

Dim sngchartwidth As Single
Dim sngchartheight As Single
Dim ssmallestside As String
Dim ismallestlength As Integer
Dim idivisionlength As Integer


objChartArea = objChart.ChartArea

'----------------- sizing the pie chart to the correct size and centering
With objChart
If objChartArea.Width <= objChartArea.Height Then
ismallestlength = CInt(objChartArea.Width)
ssmallestside = "W"
End If
If objChartArea.Height < objChartArea.Width Then
ismallestlength = CInt(objChartArea.Height)
ssmallestside = "H"
End If
idivisionlength = CInt(ismallestlength / 6)
.PlotArea.Width = idivisionlength * 4

If ssmallestside = "H" Then
.PlotArea.Top = idivisionlength
.PlotArea.Left = (.ChartArea.Width - .ChartArea.Height) / 2
.PlotArea.Left = .PlotArea.Left + idivisionlength
End If

If ssmallestside = "W" Then
.PlotArea.Left = idivisionlength
.PlotArea.Top = (.ChartArea.Height - .ChartArea.Width) / 2
.PlotArea.Top = .PlotArea.Top + idivisionlength
End If
End With
'----------------------------


Catch objCOMException As System.Runtime.InteropServices.COMException
mobjCOMException = objCOMException
Catch objException As Exception
mobjException = objException

Finally
objChart = Nothing
objSeries = Nothing
objChartArea = Nothing

If gbDEBUG = True Or _
((IsNothing(mobjCOMException) = False Or IsNothing(mobjException) = False)) Then

Call clsError.Handle("ChartSeries_FormatDoughnut", msMODULENAME, _
"apply the customised 'Doughnut' formatting to the active chart.", _
mobjCOMException, mobjException)
End If
End Try
End Sub

ChartSeries_FormatLine

public void ChartSeries_FormatLine(Excel.Chart objChart, Excel.Series objSeries, int iSeriesNo, int iBorderColour = 0, int iBorderWeight = 3, string sBorderLineStyle = "CT", bool bSmooth = false, int iMarkerForeColour = 0, int iMarkerBackColour = 0, string sMarkerStyleKey = "NO", int iMarkerSize = 3, bool bMarkerShadow = false, bool bDropLines = false, bool bHiLoLines = false, bool bUpDownBars = false, int iGapWidth = 0, bool bVaryByCategories = false)
{
Excel.ChartGroup objChartGroup1;
Excel.ChartGroup objChartGroup2;

try
{
if (clsError.ErrorFlag() == true)
return;

{
var withBlock = objSeries;
if (iBorderColour == 0)
withBlock.Border.ColorIndex = Colour_LineReturn(iSeriesNo);
// 25 is the start of the line styles
if (iBorderColour > 0)
withBlock.Border.Color = iBorderColour;

withBlock.Border.LineStyle = ChartReturns_LineStyle(sBorderLineStyle);
withBlock.Border.Weight = ChartReturns_BorderWeight(iBorderWeight);
withBlock.Smooth = bSmooth;


withBlock.ApplyDataLabels(Excel.XlDataLabelsType.xlDataLabelsShowNone);

if (sMarkerStyleKey != "NO")
{
withBlock.MarkerForegroundColorIndex = (Excel.XlColorIndex)iMarkerForeColour;
withBlock.MarkerBackgroundColorIndex = (Excel.XlColorIndex)iMarkerBackColour;
// have to have the style last
withBlock.MarkerStyle = ChartReturns_MarkerStyle(sMarkerStyleKey);
withBlock.MarkerSize = iMarkerSize;
withBlock.Shadow = bMarkerShadow;
}

// the groups are relative to which axes the series is on
if (ChartSeries_AxisUsed(objSeries) == "P")
{
objChartGroup1 = (Excel.ChartGroup)objChart.ChartGroups(1);
{
var withBlock1 = objChartGroup1;
withBlock1.HasDropLines = bDropLines;
withBlock1.HasHiLoLines = bHiLoLines;
withBlock1.HasUpDownBars = bUpDownBars;
withBlock1.VaryByCategories = bVaryByCategories;
}
}

if (ChartSeries_AxisUsed(objSeries) == "S")
{
objChartGroup2 = (Excel.ChartGroup)objChart.ChartGroups(2);
{
var withBlock1 = objChartGroup2;
withBlock1.HasDropLines = bDropLines;
withBlock1.HasHiLoLines = bHiLoLines;
withBlock1.HasUpDownBars = bUpDownBars;
withBlock1.VaryByCategories = bVaryByCategories;
}
}

if (ChartType_SeriesTypeIsIt3D(objSeries) == true)
ChartSeries_Format3D(objChart, objSeries, iSeriesNo);
}
}
catch (Runtime.InteropServices.COMException objCOMException)
{
mobjCOMException = objCOMException;
}
catch (Exception objException)
{
mobjException = objException;
}

finally
{
objChart = null/* TODO Change to default(_) if this is not a reference type */;
objSeries = null/* TODO Change to default(_) if this is not a reference type */;
objChartGroup1 = null/* TODO Change to default(_) if this is not a reference type */;
objChartGroup2 = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(mobjCOMException) == false | IsNothing(mobjException) == false)))
clsError.Handle("ChartSeries_FormatLine", msMODULENAME, "apply the customised 'Line' formatting to the active chart.", mobjCOMException, mobjException);
}
}
Public Sub ChartSeries_FormatLine(ByVal objChart As Excel.Chart, _
ByVal objSeries As Excel.Series, _
ByVal iSeriesNo As Integer, _
Optional ByVal iBorderColour As Integer = 0, _
Optional ByVal iBorderWeight As Integer = 3, _
Optional ByVal sBorderLineStyle As String = "CT", _
Optional ByVal bSmooth As Boolean = False, _
Optional ByVal iMarkerForeColour As Integer = 0, _
Optional ByVal iMarkerBackColour As Integer = 0, _
Optional ByVal sMarkerStyleKey As String = "NO", _
Optional ByVal iMarkerSize As Integer = 3, _
Optional ByVal bMarkerShadow As Boolean = False, _
Optional ByVal bDropLines As Boolean = False, _
Optional ByVal bHiLoLines As Boolean = False, _
Optional ByVal bUpDownBars As Boolean = False, _
Optional ByVal iGapWidth As Integer = 0, _
Optional ByVal bVaryByCategories As Boolean = False)

Dim objChartGroup1 As Excel.ChartGroup
Dim objChartGroup2 As Excel.ChartGroup

Try
If clsError.ErrorFlag() = True Then Exit Sub

With objSeries
If iBorderColour = 0 Then _
.Border.ColorIndex = Colour_LineReturn(iSeriesNo)
'25 is the start of the line styles
If iBorderColour > 0 Then .Border.Color = iBorderColour

.Border.LineStyle = ChartReturns_LineStyle(sBorderLineStyle)
.Border.Weight = ChartReturns_BorderWeight(iBorderWeight)
.Smooth = bSmooth


.ApplyDataLabels(Excel.XlDataLabelsType.xlDataLabelsShowNone)

If sMarkerStyleKey <> "NO" Then
.MarkerForegroundColorIndex = CType(iMarkerForeColour, Excel.XlColorIndex)
.MarkerBackgroundColorIndex = CType(iMarkerBackColour, Excel.XlColorIndex)
'have to have the style last
.MarkerStyle = ChartReturns_MarkerStyle(sMarkerStyleKey)
.MarkerSize = iMarkerSize
.Shadow = bMarkerShadow
End If

'the groups are relative to which axes the series is on
If ChartSeries_AxisUsed(objSeries) = "P" Then
objChartGroup1 = CType(objChart.ChartGroups(1), Excel.ChartGroup)
With objChartGroup1
.HasDropLines = bDropLines
.HasHiLoLines = bHiLoLines
.HasUpDownBars = bUpDownBars
.VaryByCategories = bVaryByCategories
End With
End If

If ChartSeries_AxisUsed(objSeries) = "S" Then
objChartGroup2 = CType(objChart.ChartGroups(2), Excel.ChartGroup)
With objChartGroup2
.HasDropLines = bDropLines
.HasHiLoLines = bHiLoLines
.HasUpDownBars = bUpDownBars
.VaryByCategories = bVaryByCategories
End With
End If

If ChartType_SeriesTypeIsIt3D(objSeries) = True Then
Call ChartSeries_Format3D(objChart, objSeries, iSeriesNo)
End If

End With

Catch objCOMException As System.Runtime.InteropServices.COMException
mobjCOMException = objCOMException
Catch objException As Exception
mobjException = objException

Finally
objChart = Nothing
objSeries = Nothing
objChartGroup1 = Nothing
objChartGroup2 = Nothing

If gbDEBUG = True Or _
((IsNothing(mobjCOMException) = False Or IsNothing(mobjException) = False)) Then

Call clsError.Handle("ChartSeries_FormatLine", msMODULENAME, _
"apply the customised 'Line' formatting to the active chart.", _
mobjCOMException, mobjException)
End If
End Try
End Sub

ChartSeries_FormatPie

public void ChartSeries_FormatPie(Excel.Chart objChart, Excel.Series objSeries, int iSeriesNo, int iBorderColour = 0, int iBorderWeight = 1, string sBorderLineStyle = "NO", int iFirstAngleSlice = 0, int iExplosion = 0, bool bVaryByCategories = true)
{
Excel.ChartGroup objChartGroup;
Excel.ChartArea objChartArea;
Excel.Points objPointsCol;
Excel.Point objPoint;

try
{
if (clsError.ErrorFlag() == true)
return;

float sngchartwidth;
float sngchartheight;
int icount;
int ipointcount;
string ssmallestside;
int ismallestlength;
int idivisionlength;

objChartArea = objChart.ChartArea;

{
var withBlock = objSeries;
objChartGroup = (Excel.ChartGroup)objChart.ChartGroups(1);
{
var withBlock1 = objChartGroup;
withBlock1.VaryByCategories = bVaryByCategories;
withBlock1.FirstSliceAngle = iFirstAngleSlice;
}

withBlock.Explosion = iExplosion;
withBlock.ApplyDataLabels(Excel.XlDataLabelsType.xlDataLabelsShowPercent);

withBlock.HasLeaderLines = false;

// .Has3DEffect = False
// .HasErrorBars = false
// .HasDataLabels = True

objPointsCol = (Excel.Points)objSeries.Points;

for (ipointcount = 1; ipointcount <= objPointsCol.Count; ipointcount++)
{
objPoint = (Excel.Point)withBlock.Points(ipointcount);

{
var withBlock1 = objPoint;
withBlock1.Border.Color = iBorderColour;
withBlock1.Border.Weight = ChartReturns_BorderWeight(iBorderWeight);
withBlock1.Border.LineStyle = ChartReturns_LineStyle(sBorderLineStyle);

withBlock1.Interior.Pattern = Excel.XlPattern.xlPatternSolid; // xlSolid
withBlock1.Interior.ColorIndex = Colour_AreaReturn(ipointcount);
}
}
}
// ----------------- sizing the pie chart to the correct size and centering
{
var withBlock = objChart;
if (objChartArea.Width <= objChartArea.Height)
{
ismallestlength = System.Convert.ToInt32(objChartArea.Width);
ssmallestside = "W";
}
if (objChartArea.Height < objChartArea.Width)
{
ismallestlength = System.Convert.ToInt32(objChartArea.Height);
ssmallestside = "H";
}

// subtract the size of the legend so the pie chart is perfectly in the middle
if ((objChart.HasLegend == false))
{
idivisionlength = System.Convert.ToInt32(ismallestlength / (double)6);
withBlock.PlotArea.Width = idivisionlength * 4;

if (ssmallestside == "H")
{
withBlock.PlotArea.Top = idivisionlength;
withBlock.PlotArea.Left = (withBlock.ChartArea.Width - withBlock.ChartArea.Height) / (double)2;
withBlock.PlotArea.Left = withBlock.PlotArea.Left + idivisionlength;
}

if (ssmallestside == "W")
{
withBlock.PlotArea.Left = idivisionlength;
withBlock.PlotArea.Top = (withBlock.ChartArea.Height - withBlock.ChartArea.Width) / (double)2;
withBlock.PlotArea.Top = withBlock.PlotArea.Top + idivisionlength;
}
}
else
{
if (App_RegTypesPieAutomaticLegendPositionRead() == true)
{
if (ssmallestside == "H")
// put the legend on the right (have option to put on left)
ChartFormat_LegendSizePosition(objChart, "RI");

if (ssmallestside == "W")
// put the legend underneath
ChartFormat_LegendSizePosition(objChart, "BT");
}

idivisionlength = System.Convert.ToInt32(ismallestlength / (double)6);
withBlock.PlotArea.Width = idivisionlength * 4;

if (ssmallestside == "H")
{
withBlock.PlotArea.Top = idivisionlength;
withBlock.PlotArea.Left = (withBlock.ChartArea.Width - withBlock.ChartArea.Height) / (double)2;
withBlock.PlotArea.Left = withBlock.PlotArea.Left + idivisionlength;

// if we are moving the position of the plot area
if (true)
// legend is on the right so move plot area to the left
withBlock.PlotArea.Left = withBlock.PlotArea.Left - (withBlock.Legend.Width / (double)2);
}

if (ssmallestside == "W")
{
withBlock.PlotArea.Left = idivisionlength;
withBlock.PlotArea.Top = (withBlock.ChartArea.Height - withBlock.ChartArea.Width) / (double)2;
withBlock.PlotArea.Top = withBlock.PlotArea.Top + idivisionlength;

// if we are moving the position of the plot area
if (true)
// legend is below so move the plot area up
withBlock.PlotArea.Top = withBlock.PlotArea.Top - (withBlock.Legend.Height / (double)2);
}
}
}
}
// ----------------------------

catch (Runtime.InteropServices.COMException objCOMException)
{
mobjCOMException = objCOMException;
}
catch (Exception objException)
{
mobjException = objException;
}

finally
{
objChart = null/* TODO Change to default(_) if this is not a reference type */;
objSeries = null/* TODO Change to default(_) if this is not a reference type */;
objChartGroup = null/* TODO Change to default(_) if this is not a reference type */;
objChartArea = null/* TODO Change to default(_) if this is not a reference type */;
objPointsCol = null/* TODO Change to default(_) if this is not a reference type */;
objPoint = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(mobjCOMException) == false | IsNothing(mobjException) == false)))
clsError.Handle("ChartSeries_FormatPie", msMODULENAME, "apply the customised 'Pie' formatting to the active chart.", mobjCOMException, mobjException);
}
}
Public Sub ChartSeries_FormatPie(ByVal objChart As Excel.Chart, _
ByVal objSeries As Excel.Series, _
ByVal iSeriesNo As Integer, _
Optional ByVal iBorderColour As Integer = 0, _
Optional ByVal iBorderWeight As Integer = 1, _
Optional ByVal sBorderLineStyle As String = "NO", _
Optional ByVal iFirstAngleSlice As Integer = 0, _
Optional ByVal iExplosion As Integer = 0, _
Optional ByVal bVaryByCategories As Boolean = True)

Dim objChartGroup As Excel.ChartGroup
Dim objChartArea As Excel.ChartArea
Dim objPointsCol As Excel.Points
Dim objPoint As Excel.Point

Try
If clsError.ErrorFlag() = True Then Exit Sub

Dim sngchartwidth As Single
Dim sngchartheight As Single
Dim icount As Integer
Dim ipointcount As Integer
Dim ssmallestside As String
Dim ismallestlength As Integer
Dim idivisionlength As Integer

objChartArea = objChart.ChartArea

With objSeries
objChartGroup = CType(objChart.ChartGroups(1), Excel.ChartGroup)
With objChartGroup
.VaryByCategories = bVaryByCategories
.FirstSliceAngle = iFirstAngleSlice
End With

.Explosion = iExplosion
.ApplyDataLabels(Excel.XlDataLabelsType.xlDataLabelsShowPercent)

.HasLeaderLines = False

'.Has3DEffect = False
'.HasErrorBars = false
'.HasDataLabels = True

objPointsCol = CType(objSeries.Points, Excel.Points)

For ipointcount = 1 To objPointsCol.Count
objPoint = CType(.Points(ipointcount), Excel.Point)

With objPoint
.Border.Color = iBorderColour
.Border.Weight = ChartReturns_BorderWeight(iBorderWeight)
.Border.LineStyle = ChartReturns_LineStyle(sBorderLineStyle)

.Interior.Pattern = Excel.XlPattern.xlPatternSolid 'xlSolid
.Interior.ColorIndex = Colour_AreaReturn(ipointcount)
End With
Next ipointcount

' .AxisGroup = 1 'this should apply to all pie charts I think

End With
'----------------- sizing the pie chart to the correct size and centering
With objChart
If objChartArea.Width <= objChartArea.Height Then
ismallestlength = CInt(objChartArea.Width)
ssmallestside = "W"
End If
If objChartArea.Height < objChartArea.Width Then
ismallestlength = CInt(objChartArea.Height)
ssmallestside = "H"
End If

'subtract the size of the legend so the pie chart is perfectly in the middle
If (objChart.HasLegend = False) Then
idivisionlength = CInt(ismallestlength / 6)
.PlotArea.Width = idivisionlength * 4

If ssmallestside = "H" Then
.PlotArea.Top = idivisionlength
.PlotArea.Left = (.ChartArea.Width - .ChartArea.Height) / 2
.PlotArea.Left = .PlotArea.Left + idivisionlength
End If

If ssmallestside = "W" Then
.PlotArea.Left = idivisionlength
.PlotArea.Top = (.ChartArea.Height - .ChartArea.Width) / 2
.PlotArea.Top = .PlotArea.Top + idivisionlength
End If
Else
If App_RegTypesPieAutomaticLegendPositionRead() = True Then
If ssmallestside = "H" Then
'put the legend on the right (have option to put on left)
Call ChartFormat_LegendSizePosition(objChart, "RI")
End If

If ssmallestside = "W" Then
'put the legend underneath
Call ChartFormat_LegendSizePosition(objChart, "BT")
End If
End If

idivisionlength = CInt(ismallestlength / 6)
.PlotArea.Width = idivisionlength * 4

If ssmallestside = "H" Then
.PlotArea.Top = idivisionlength
.PlotArea.Left = (.ChartArea.Width - .ChartArea.Height) / 2
.PlotArea.Left = .PlotArea.Left + idivisionlength

'if we are moving the position of the plot area
If True Then
'legend is on the right so move plot area to the left
.PlotArea.Left = .PlotArea.Left - (.Legend.Width / 2)
End If

End If

If ssmallestside = "W" Then
.PlotArea.Left = idivisionlength
.PlotArea.Top = (.ChartArea.Height - .ChartArea.Width) / 2
.PlotArea.Top = .PlotArea.Top + idivisionlength

'if we are moving the position of the plot area
If True Then
'legend is below so move the plot area up
.PlotArea.Top = .PlotArea.Top - (.Legend.Height / 2)
End If
End If
End If
End With
'----------------------------

Catch objCOMException As System.Runtime.InteropServices.COMException
mobjCOMException = objCOMException
Catch objException As Exception
mobjException = objException

Finally
objChart = Nothing
objSeries = Nothing
objChartGroup = Nothing
objChartArea = Nothing
objPointsCol = Nothing
objPoint = Nothing

If gbDEBUG = True Or _
((IsNothing(mobjCOMException) = False Or IsNothing(mobjException) = False)) Then

Call clsError.Handle("ChartSeries_FormatPie", msMODULENAME, _
"apply the customised 'Pie' formatting to the active chart.", _
mobjCOMException, mobjException)
End If
End Try
End Sub

ChartSeries_FormatPyramid

public void ChartSeries_FormatPyramid(Excel.Chart objChart, Excel.Series objSeries, int iSeriesNo)
{
try
{
if (clsError.ErrorFlag() == true)
return;
}

catch (Runtime.InteropServices.COMException objCOMException)
{
mobjCOMException = objCOMException;
}
catch (Exception objException)
{
mobjException = objException;
}

finally
{
objChart = null/* TODO Change to default(_) if this is not a reference type */;
objSeries = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(mobjCOMException) == false | IsNothing(mobjException) == false)))
clsError.Handle("ChartSeries_FormatPyramid", msMODULENAME, "apply the customised 'Pyramid' formatting to the active chart.", mobjCOMException, mobjException);
}
}
Public Sub ChartSeries_FormatPyramid(ByVal objChart As Excel.Chart, _
ByVal objSeries As Excel.Series, _
ByVal iSeriesNo As Integer)

Try
If clsError.ErrorFlag() = True Then Exit Sub


Catch objCOMException As System.Runtime.InteropServices.COMException
mobjCOMException = objCOMException
Catch objException As Exception
mobjException = objException

Finally
objChart = Nothing
objSeries = Nothing

If gbDEBUG = True Or _
((IsNothing(mobjCOMException) = False Or IsNothing(mobjException) = False)) Then

Call clsError.Handle("ChartSeries_FormatPyramid", msMODULENAME, _
"apply the customised 'Pyramid' formatting to the active chart.", _
mobjCOMException, mobjException)
End If
End Try
End Sub

ChartSeries_FormatRadar

public void ChartSeries_FormatRadar(Excel.Chart objChart, Excel.Series objSeries, int iSeriesNo)
{
Excel.ChartArea objChartArea;

try
{
if (clsError.ErrorFlag() == true)
return;

float sngchartwidth;
float sngchartheight;
string ssmallestside;
int ismallestlength;
int idivisionlength;


// If sMarkerStyleKey <> "NO" Then
// .MarkerForegroundColorIndex = iMarkerForeColour
// .MarkerBackgroundColorIndex = iMarkerBackColour
// have to have the style last
// .MarkerStyle = Return_MarkerStyle(sMarkerStyleKey)
// .MarkerSize = iMarkerSize
// .Shadow = bMarkerShadow
// End If

objChartArea = objChart.ChartArea;

// ----------------- sizing the pie chart to the correct size and centering
{
var withBlock = objChart;
if (objChartArea.Width <= objChartArea.Height)
{
ismallestlength = System.Convert.ToInt32(objChartArea.Width);
ssmallestside = "W";
}
if (objChartArea.Height < objChartArea.Width)
{
ismallestlength = System.Convert.ToInt32(objChartArea.Height);
ssmallestside = "H";
}
idivisionlength = System.Convert.ToInt32(ismallestlength / (double)6);
withBlock.PlotArea.Width = idivisionlength * 4;

if (ssmallestside == "H")
{
withBlock.PlotArea.Top = idivisionlength;
withBlock.PlotArea.Left = (withBlock.ChartArea.Width - withBlock.ChartArea.Height) / (double)2;
withBlock.PlotArea.Left = withBlock.PlotArea.Left + idivisionlength;
}

if (ssmallestside == "W")
{
withBlock.PlotArea.Left = idivisionlength;
withBlock.PlotArea.Top = (withBlock.ChartArea.Height - withBlock.ChartArea.Width) / (double)2;
withBlock.PlotArea.Top = withBlock.PlotArea.Top + idivisionlength;
}
}
}
// ----------------------------


catch (Runtime.InteropServices.COMException objCOMException)
{
mobjCOMException = objCOMException;
}
catch (Exception objException)
{
mobjException = objException;
}

finally
{
objChart = null/* TODO Change to default(_) if this is not a reference type */;
objSeries = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(mobjCOMException) == false | IsNothing(mobjException) == false)))
clsError.Handle("ChartSeries_FormatRadar", msMODULENAME, "apply the customised 'Radar' formatting to the active chart.", mobjCOMException, mobjException);
}
}
Public Sub ChartSeries_FormatRadar(ByVal objChart As Excel.Chart, _
ByVal objSeries As Excel.Series, _
ByVal iSeriesNo As Integer)

Dim objChartArea As Excel.ChartArea

Try
If clsError.ErrorFlag() = True Then Exit Sub

Dim sngchartwidth As Single
Dim sngchartheight As Single
Dim ssmallestside As String
Dim ismallestlength As Integer
Dim idivisionlength As Integer


' If sMarkerStyleKey <> "NO" Then
' .MarkerForegroundColorIndex = iMarkerForeColour
' .MarkerBackgroundColorIndex = iMarkerBackColour
' have to have the style last
' .MarkerStyle = Return_MarkerStyle(sMarkerStyleKey)
' .MarkerSize = iMarkerSize
' .Shadow = bMarkerShadow
' End If

objChartArea = objChart.ChartArea

'----------------- sizing the pie chart to the correct size and centering
With objChart
If objChartArea.Width <= objChartArea.Height Then
ismallestlength = CInt(objChartArea.Width)
ssmallestside = "W"
End If
If objChartArea.Height < objChartArea.Width Then
ismallestlength = CInt(objChartArea.Height)
ssmallestside = "H"
End If
idivisionlength = CInt(ismallestlength / 6)
.PlotArea.Width = idivisionlength * 4

If ssmallestside = "H" Then
.PlotArea.Top = idivisionlength
.PlotArea.Left = (.ChartArea.Width - .ChartArea.Height) / 2
.PlotArea.Left = .PlotArea.Left + idivisionlength
End If

If ssmallestside = "W" Then
.PlotArea.Left = idivisionlength
.PlotArea.Top = (.ChartArea.Height - .ChartArea.Width) / 2
.PlotArea.Top = .PlotArea.Top + idivisionlength
End If
End With
'----------------------------


Catch objCOMException As System.Runtime.InteropServices.COMException
mobjCOMException = objCOMException
Catch objException As Exception
mobjException = objException

Finally
objChart = Nothing
objSeries = Nothing

If gbDEBUG = True Or _
((IsNothing(mobjCOMException) = False Or IsNothing(mobjException) = False)) Then

Call clsError.Handle("ChartSeries_FormatRadar", msMODULENAME, _
"apply the customised 'Radar' formatting to the active chart.", _
mobjCOMException, mobjException)
End If
End Try
End Sub

ChartSeries_FormatScatter

public void ChartSeries_FormatScatter(Excel.Chart objChart, Excel.Series objSeries, int iSeriesNo)
{
try
{
if (clsError.ErrorFlag() == true)
return;
}

// remove the line


// If sChartType = "S" Then
// If iInteriorColourIdx = 0 Then .Interior.ColorIndex = 16 + iSeriesNo
// If iInteriorColourIdx > 0 Then .Interior.ColorIndex = 16 + iInteriorColourIdx
// .MarkerStyle
// .MarkerBackgroundColorIndex
// .MarkerForegroundColorIndex
// .MarkerSize
// .Shadow
// End If

catch (Runtime.InteropServices.COMException objCOMException)
{
mobjCOMException = objCOMException;
}
catch (Exception objException)
{
mobjException = objException;
}

finally
{
objChart = null/* TODO Change to default(_) if this is not a reference type */;
objSeries = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(mobjCOMException) == false | IsNothing(mobjException) == false)))
clsError.Handle("ChartSeries_FormatScatter", msMODULENAME, "apply the customised 'Scatter' formatting to the active chart.", mobjCOMException, mobjException);
}
}
Public Sub ChartSeries_FormatScatter(ByVal objChart As Excel.Chart, _
ByVal objSeries As Excel.Series, _
ByVal iSeriesNo As Integer)

Try
If clsError.ErrorFlag() = True Then Exit Sub

'remove the line


' If sChartType = "S" Then
' If iInteriorColourIdx = 0 Then .Interior.ColorIndex = 16 + iSeriesNo
' If iInteriorColourIdx > 0 Then .Interior.ColorIndex = 16 + iInteriorColourIdx
' .MarkerStyle
' .MarkerBackgroundColorIndex
' .MarkerForegroundColorIndex
' .MarkerSize
' .Shadow
' End If

Catch objCOMException As System.Runtime.InteropServices.COMException
mobjCOMException = objCOMException
Catch objException As Exception
mobjException = objException

Finally
objChart = Nothing
objSeries = Nothing

If gbDEBUG = True Or _
((IsNothing(mobjCOMException) = False Or IsNothing(mobjException) = False)) Then

Call clsError.Handle("ChartSeries_FormatScatter", msMODULENAME, _
"apply the customised 'Scatter' formatting to the active chart.", _
mobjCOMException, mobjException)
End If
End Try
End Sub

ChartSeries_FormatStacked

public void ChartSeries_FormatStacked(Excel.Chart objChart, Excel.Series objSeries, int iSeriesNo, int iGapWidth = 100, bool bHasSeriesLine = false, bool bShadow = false, int iOverlapWidth = 100, bool bVaryByCategories = false, int iChartDepth = 150, int iGapDepth = 100)
{
Excel.ChartGroup objChartGroup;
Excel.Axis objAxis;
Excel.TickLabels objTickLabels;

try
{
if (clsError.ErrorFlag() == true)
return;

{
var withBlock = objSeries;
withBlock.Shadow = bShadow;

withBlock.ApplyDataLabels(Excel.XlDataLabelsType.xlDataLabelsShowNone);

objChartGroup = (Excel.ChartGroup)objChart.ChartGroups(1);
{
var withBlock1 = objChartGroup;
withBlock1.Overlap = iOverlapWidth;
withBlock1.GapWidth = iGapWidth;
withBlock1.HasSeriesLines = bHasSeriesLine;
withBlock1.VaryByCategories = bVaryByCategories;
}

objAxis = (Excel.Axis)objChart.Axes(Excel.XlAxisType.xlValue, Excel.XlAxisGroup.xlPrimary);

if (ChartType_SeriesTypeIsItStacked100(objSeries) == true)
{
objTickLabels = (Excel.TickLabels)objAxis.TickLabels;
objTickLabels.NumberFormat = "0%";
}
}
}
catch (Runtime.InteropServices.COMException objCOMException)
{
mobjCOMException = objCOMException;
}
catch (Exception objException)
{
mobjException = objException;
}

finally
{
objChart = null/* TODO Change to default(_) if this is not a reference type */;
objSeries = null/* TODO Change to default(_) if this is not a reference type */;
objChartGroup = null/* TODO Change to default(_) if this is not a reference type */;
objAxis = null/* TODO Change to default(_) if this is not a reference type */;
objTickLabels = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(mobjCOMException) == false | IsNothing(mobjException) == false)))
clsError.Handle("ChartSeries_FormatStacked", msMODULENAME, "apply the customised 'Stacked' formatting to the active chart.", mobjCOMException, mobjException);
}
}
Public Sub ChartSeries_FormatStacked(ByVal objChart As Excel.Chart, _
ByVal objSeries As Excel.Series, _
ByVal iSeriesNo As Integer, _
Optional ByVal iGapWidth As Integer = 100, _
Optional ByVal bHasSeriesLine As Boolean = False, _
Optional ByVal bShadow As Boolean = False, _
Optional ByVal iOverlapWidth As Integer = 100, _
Optional ByVal bVaryByCategories As Boolean = False, _
Optional ByVal iChartDepth As Integer = 150, _
Optional ByVal iGapDepth As Integer = 100)

Dim objChartGroup As Excel.ChartGroup
Dim objAxis As Excel.Axis
Dim objTickLabels As Excel.TickLabels

Try
If clsError.ErrorFlag() = True Then Exit Sub

With objSeries
.Shadow = bShadow

.ApplyDataLabels(Excel.XlDataLabelsType.xlDataLabelsShowNone)

objChartGroup = CType(objChart.ChartGroups(1), Excel.ChartGroup)
With objChartGroup
.Overlap = iOverlapWidth
.GapWidth = iGapWidth
.HasSeriesLines = bHasSeriesLine
.VaryByCategories = bVaryByCategories
End With

objAxis = CType(objChart.Axes(Excel.XlAxisType.xlValue, _
Excel.XlAxisGroup.xlPrimary), Excel.Axis)

If ChartType_SeriesTypeIsItStacked100(objSeries) = True Then

objTickLabels = CType(objAxis.TickLabels, Excel.TickLabels)
objTickLabels.NumberFormat = "0%"

End If
End With

Catch objCOMException As System.Runtime.InteropServices.COMException
mobjCOMException = objCOMException
Catch objException As Exception
mobjException = objException

Finally
objChart = Nothing
objSeries = Nothing
objChartGroup = Nothing
objAxis = Nothing
objTickLabels = Nothing

If gbDEBUG = True Or _
((IsNothing(mobjCOMException) = False Or IsNothing(mobjException) = False)) Then

Call clsError.Handle("ChartSeries_FormatStacked", msMODULENAME, _
"apply the customised 'Stacked' formatting to the active chart.", _
mobjCOMException, mobjException)
End If
End Try
End Sub

ChartSeries_FormatStacked100

public void ChartSeries_FormatStacked100(Excel.Chart objChart, Excel.Series objSeries, int iSeriesNo, int iGapWidth = 100, bool bHasSeriesLine = false, bool bShadow = false, int iOverlapWidth = 100, bool bVaryByCategories = false, int iChartDepth = 150, int iGapDepth = 100)
{
Excel.ChartGroup objChartGroup;
Excel.Axis objAxis;
Excel.TickLabels objTickLabels;

try
{
if (clsError.ErrorFlag() == true)
return;

bool bvertically;
bool bhorizontally;

bvertically = ChartType_SeriesTypeIsItStacked100Vertical(objSeries);
bhorizontally = ChartType_SeriesTypeIsItStacked100Horizontal(objSeries);

{
var withBlock = objSeries;
withBlock.Shadow = bShadow;

withBlock.ApplyDataLabels(Excel.XlDataLabelsType.xlDataLabelsShowNone);

objChartGroup = (Excel.ChartGroup)objChart.ChartGroups(1);
{
var withBlock1 = objChartGroup;
withBlock1.Overlap = iOverlapWidth;
withBlock1.GapWidth = iGapWidth;
withBlock1.HasSeriesLines = bHasSeriesLine;
withBlock1.VaryByCategories = bVaryByCategories;
}

objAxis = (Excel.Axis)objChart.Axes(Excel.XlAxisType.xlValue, Excel.XlAxisGroup.xlPrimary);

objTickLabels = (Excel.TickLabels)objAxis.TickLabels;
objTickLabels.NumberFormat = "0%";
}
}
catch (Runtime.InteropServices.COMException objCOMException)
{
mobjCOMException = objCOMException;
}
catch (Exception objException)
{
mobjException = objException;
}

finally
{
objChart = null/* TODO Change to default(_) if this is not a reference type */;
objSeries = null/* TODO Change to default(_) if this is not a reference type */;
objChartGroup = null/* TODO Change to default(_) if this is not a reference type */;
objAxis = null/* TODO Change to default(_) if this is not a reference type */;
objTickLabels = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(mobjCOMException) == false | IsNothing(mobjException) == false)))
clsError.Handle("ChartSeries_FormatStacked100", msMODULENAME, "apply the customised 'Stacked 100' formatting to the active chart.", mobjCOMException, mobjException);
}
}
Public Sub ChartSeries_FormatStacked100(ByVal objChart As Excel.Chart, _
ByVal objSeries As Excel.Series, _
ByVal iSeriesNo As Integer, _
Optional ByVal iGapWidth As Integer = 100, _
Optional ByVal bHasSeriesLine As Boolean = False, _
Optional ByVal bShadow As Boolean = False, _
Optional ByVal iOverlapWidth As Integer = 100, _
Optional ByVal bVaryByCategories As Boolean = False, _
Optional ByVal iChartDepth As Integer = 150, _
Optional ByVal iGapDepth As Integer = 100)

Dim objChartGroup As Excel.ChartGroup
Dim objAxis As Excel.Axis
Dim objTickLabels As Excel.TickLabels

Try
If clsError.ErrorFlag() = True Then Exit Sub

Dim bvertically As Boolean
Dim bhorizontally As Boolean

bvertically = ChartType_SeriesTypeIsItStacked100Vertical(objSeries)
bhorizontally = ChartType_SeriesTypeIsItStacked100Horizontal(objSeries)

With objSeries
.Shadow = bShadow

.ApplyDataLabels(Excel.XlDataLabelsType.xlDataLabelsShowNone)

objChartGroup = CType(objChart.ChartGroups(1), Excel.ChartGroup)
With objChartGroup
.Overlap = iOverlapWidth
.GapWidth = iGapWidth
.HasSeriesLines = bHasSeriesLine
.VaryByCategories = bVaryByCategories
End With

objAxis = CType(objChart.Axes(Excel.XlAxisType.xlValue, _
Excel.XlAxisGroup.xlPrimary), Excel.Axis)

objTickLabels = CType(objAxis.TickLabels, Excel.TickLabels)
objTickLabels.NumberFormat = "0%"

End With

Catch objCOMException As System.Runtime.InteropServices.COMException
mobjCOMException = objCOMException
Catch objException As Exception
mobjException = objException

Finally
objChart = Nothing
objSeries = Nothing
objChartGroup = Nothing
objAxis = Nothing
objTickLabels = Nothing

If gbDEBUG = True Or _
((IsNothing(mobjCOMException) = False Or IsNothing(mobjException) = False)) Then

Call clsError.Handle("ChartSeries_FormatStacked100", msMODULENAME, _
"apply the customised 'Stacked 100' formatting to the active chart.", _
mobjCOMException, mobjException)
End If
End Try
End Sub

ChartSeries_FormatStock

public void ChartSeries_FormatStock(Excel.Chart objChart, Excel.Series objSeries, int iSeriesNo)
{
try
{
if (clsError.ErrorFlag() == true)
return;
}

catch (Runtime.InteropServices.COMException objCOMException)
{
mobjCOMException = objCOMException;
}
catch (Exception objException)
{
mobjException = objException;
}

finally
{
objChart = null/* TODO Change to default(_) if this is not a reference type */;
objSeries = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(mobjCOMException) == false | IsNothing(mobjException) == false)))
clsError.Handle("ChartSeries_FormatStock", msMODULENAME, "apply the customised 'Stock' formatting to the active chart.", mobjCOMException, mobjException);
}
}
Public Sub ChartSeries_FormatStock(ByVal objChart As Excel.Chart, _
ByVal objSeries As Excel.Series, _
ByVal iSeriesNo As Integer)

Try
If clsError.ErrorFlag() = True Then Exit Sub


Catch objCOMException As System.Runtime.InteropServices.COMException
mobjCOMException = objCOMException
Catch objException As Exception
mobjException = objException

Finally
objChart = Nothing
objSeries = Nothing

If gbDEBUG = True Or _
((IsNothing(mobjCOMException) = False Or IsNothing(mobjException) = False)) Then

Call clsError.Handle("ChartSeries_FormatStock", msMODULENAME, _
"apply the customised 'Stock' formatting to the active chart.", _
mobjCOMException, mobjException)
End If
End Try
End Sub

ChartSeries_FormatSurface

public void ChartSeries_FormatSurface(Excel.Chart objChart, Excel.Series objSeries, int iSeriesNo)
{
try
{
if (clsError.ErrorFlag() == true)
return;
}


catch (Runtime.InteropServices.COMException objCOMException)
{
mobjCOMException = objCOMException;
}
catch (Exception objException)
{
mobjException = objException;
}

finally
{
objChart = null/* TODO Change to default(_) if this is not a reference type */;
objSeries = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(mobjCOMException) == false | IsNothing(mobjException) == false)))
clsError.Handle("ChartSeries_FormatSurface", msMODULENAME, "apply the customised 'Surface' formatting to the active chart.", mobjCOMException, mobjException);
}
}
Public Sub ChartSeries_FormatSurface(ByVal objChart As Excel.Chart, _
ByVal objSeries As Excel.Series, _
ByVal iSeriesNo As Integer)

Try
If clsError.ErrorFlag() = True Then Exit Sub



Catch objCOMException As System.Runtime.InteropServices.COMException
mobjCOMException = objCOMException
Catch objException As Exception
mobjException = objException

Finally
objChart = Nothing
objSeries = Nothing

If gbDEBUG = True Or _
((IsNothing(mobjCOMException) = False Or IsNothing(mobjException) = False)) Then

Call clsError.Handle("ChartSeries_FormatSurface", msMODULENAME, _
"apply the customised 'Surface' formatting to the active chart.", _
mobjCOMException, mobjException)
End If
End Try
End Sub

ChartSeries_FormulaXValuesGet

public string ChartSeries_FormulaXValuesGet(Excel.Series objSeries)
{
try
{
if (clsError.ErrorFlag() == true)
return;

string sFormula;
int icharpos;

sFormula = objSeries.Formula;
sFormula = Strings.Right(sFormula, Strings.Len(sFormula) - Strings.Len("=SERIES("));

if (Strings.Left(sFormula, 1) != "'")
{
icharpos = InStr(sFormula, ",");
sFormula = Strings.Right(sFormula, Strings.Len(sFormula) - icharpos);
}
else
{
icharpos = clsStr.FindPositionOfOddSeq(sFormula, "!", "'", 3);

sFormula = Strings.Right(sFormula, Strings.Len(sFormula) - icharpos);
sFormula = Right(sFormula, Strings.Len(sFormula) - InStr(sFormula, ","));
}

if (Strings.Left(sFormula, 1) != "'")
icharpos = InStr(sFormula, ",");

if (Strings.Left(sFormula, 1) == "'")
icharpos = clsStr.FindPositionOfOddSeq(sFormula, "!", "'", 3);

ChartSeries_FormulaXValuesGet = Left(sFormula, InStr(icharpos, sFormula, ",") - 1);
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objSeries = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartSeries_FormulaLabelsGet", msMODULENAME, "return the series 'LABELS' component for series " + objSeries.Name + " for the active chart", gobjCOMException, gobjException);
}
}
Public Function ChartSeries_FormulaXValuesGet(ByVal objSeries As Excel.Series) As String

Try
If clsError.ErrorFlag() = True Then Exit Function

Dim sFormula As String
Dim icharpos As Integer

sFormula = objSeries.Formula
sFormula = Right(sFormula, Len(sFormula) - Len("=SERIES("))

If Left(sFormula, 1) <> "'" Then
icharpos = InStr(sFormula, ",")
sFormula = Right(sFormula, Len(sFormula) - icharpos)
Else
icharpos = clsStr.FindPositionOfOddSeq(sFormula, "!", "'", 3)

sFormula = Right(sFormula, Len(sFormula) - icharpos)
sFormula = Right(sFormula, Len(sFormula) - InStr(sFormula, ","))
End If

If Left(sFormula, 1) <> "'" Then icharpos = InStr(sFormula, ",")

If Left(sFormula, 1) = "'" Then
icharpos = clsStr.FindPositionOfOddSeq(sFormula, "!", "'", 3)
End If

ChartSeries_FormulaXValuesGet = Left(sFormula, InStr(icharpos, sFormula, ",") - 1)

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objSeries = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartSeries_FormulaLabelsGet", msMODULENAME, _
"return the series 'LABELS' component for series " & objSeries.Name & _
" for the active chart", _
gobjCOMException, gobjException)
End If
End Try

End Function

ChartSeries_FormulaYValuesGet

public string ChartSeries_FormulaValuesGet(Excel.Series objSeries)
{
try
{
if (clsError.ErrorFlag() == true)
return;

string sFormula;
int icharpos;

sFormula = objSeries.Formula;
sFormula = Strings.Right(sFormula, Strings.Len(sFormula) - Strings.Len("=SERIES("));

if (Strings.Left(sFormula, 1) != "'")
{
icharpos = InStr(sFormula, ",");
sFormula = Strings.Right(sFormula, Strings.Len(sFormula) - icharpos);
}
else
{
icharpos = clsStr.FindPositionOfOddSeq(sFormula, "!", "'", 3);
sFormula = Strings.Right(sFormula, Strings.Len(sFormula) - icharpos);
sFormula = Right(sFormula, Strings.Len(sFormula) - InStr(sFormula, ","));
}

if (Strings.Left(sFormula, 1) != "'")
{
icharpos = InStr(sFormula, ",");
sFormula = Strings.Right(sFormula, Strings.Len(sFormula) - icharpos);
}
else
{
icharpos = clsStr.FindPositionOfOddSeq(sFormula, "!", "'", 3);
sFormula = Strings.Right(sFormula, Strings.Len(sFormula) - icharpos);
sFormula = Right(sFormula, Strings.Len(sFormula) - InStr(sFormula, ","));
}

ChartSeries_FormulaValuesGet = Left(sFormula, InStr(1, sFormula, ",") - 1);
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objSeries = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartSeries_FormulaValuesGet", msMODULENAME, "return the series 'VALUES' component for series " + objSeries.Name + " for the active chart", gobjCOMException, gobjException);
}
}
Public Function ChartSeries_FormulaValuesGet(ByVal objSeries As Excel.Series) As String

Try
If clsError.ErrorFlag() = True Then Exit Function

Dim sFormula As String
Dim icharpos As Integer

sFormula = objSeries.Formula
sFormula = Right(sFormula, Len(sFormula) - Len("=SERIES("))

If Left(sFormula, 1) <> "'" Then
icharpos = InStr(sFormula, ",")
sFormula = Right(sFormula, Len(sFormula) - icharpos)
Else
icharpos = clsStr.FindPositionOfOddSeq(sFormula, "!", "'", 3)
sFormula = Right(sFormula, Len(sFormula) - icharpos)
sFormula = Right(sFormula, Len(sFormula) - InStr(sFormula, ","))
End If

If Left(sFormula, 1) <> "'" Then
icharpos = InStr(sFormula, ",")
sFormula = Right(sFormula, Len(sFormula) - icharpos)
Else
icharpos = clsStr.FindPositionOfOddSeq(sFormula, "!", "'", 3)
sFormula = Right(sFormula, Len(sFormula) - icharpos)
sFormula = Right(sFormula, Len(sFormula) - InStr(sFormula, ","))
End If

ChartSeries_FormulaValuesGet = Left(sFormula, InStr(1, sFormula, ",") - 1)

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objSeries = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartSeries_FormulaValuesGet", msMODULENAME, _
"return the series 'VALUES' component for series " & objSeries.Name & _
" for the active chart", _
gobjCOMException, gobjException)
End If
End Try
End Function

ChartSeries_Type_Change

public void ChartSeries_Type_Change(Excel.Series objSeries, Excel.XlChartType iChartType)
{
try
{
if (clsError.ErrorFlag() == true)
return;

objSeries.ChartType = (Excel.XlChartType)iChartType;

objSeries.Select();
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objSeries = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("Chart_SeriesTypeChange", msMODULENAME, "change the type of the active chart series.", gobjCOMException, gobjException);
}
}
Public Sub ChartSeries_Type_Change(ByVal objSeries As Excel.Series, _
ByVal iChartType As Excel.XlChartType)

Try
If clsError.ErrorFlag() = True Then Exit Sub

objSeries.ChartType = CType(iChartType, Excel.XlChartType)

objSeries.Select()

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objSeries = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("Chart_SeriesTypeChange", msMODULENAME, _
"change the type of the active chart series.", _
gobjCOMException, gobjException)
End If
End Try
End Sub

ChartSeries_Type_Convert

public long ChartSeries_Type_Convert(int iSeriesNo)
{
Excel.Chart objChart;
Excel.Series objSeries;

try
{
if (clsError.ErrorFlag() == true)
return;

int itype;

objChart = gApplication.ActiveChart;
objSeries = (Excel.Series)objChart.SeriesCollection(iSeriesNo);

switch (objSeries.ChartType.ToString + Space(26 - objSeries.ChartType.ToString.Length))
{
case "xlColumnClustered ":
{
itype = xlColumnClustered;
break;
}

case "xlColumnStacked ":
{
itype = xlColumnStacked;
break;
}

case "xlColumnStacked100 ":
{
itype = xlColumnStacked100;
break;
}

case "xl3DColumnClustered ":
{
itype = xlColumnClustered;
break;
}

case "xl3DColumnStacked ":
{
itype = xlColumnStacked;
break;
}

case "xl3DColumnStacked100 ":
{
itype = xlColumnStacked100;
break;
}

case "xl3DColumn ":
{
itype = xlColumnClustered;
break;
}

case "xlBarClustered ":
{
itype = xlBarClustered;
break;
}

case "xlBarStacked ":
{
itype = xlBarStacked;
break;
}

case "xlBarStacked100 ":
{
itype = xlBarStacked100;
break;
}

case "xl3DBarClustered ":
{
itype = xlBarClustered;
break;
}

case "xl3DBarStacked ":
{
itype = xlBarStacked;
break;
}

case "xl3DBarStacked100 ":
{
itype = xlBarStacked100;
break;
}

case "xlLine ":
{
itype = xlLine;
break;
}

case "xlLineStacked ":
{
itype = xlLine;
break;
}

case "xlLineStacked100 ":
{
itype = xlLine;
break;
}

case "xlLineMarkers ":
{
itype = xlLine;
break;
}

case "xlLineMarkersStacked ":
{
itype = xlLine;
break;
}

case "xlLineMarkersStacked100 ":
{
itype = xlLine;
break;
}

case "xl3DLine ":
{
itype = xlLine;
break;
}

case "xlPie ":
{
itype = xlPie;
break;
}

case "xlPieExploded ":
{
itype = xlPie;
break;
}

case "xlPieOfPie ":
{
itype = xlPie;
break;
}

case "xl3DPie ":
{
itype = xlPie;
break;
}

case "xl3DPieExploded ":
{
itype = xlPie;
break;
}

case "xlBarOfPie ":
{
itype = xlPie;
break;
}

case "xlXYScatter ":
{
itype = xlXYScatter;
break;
}

case "xlXYScatterLines ":
{
itype = xlXYScatter;
break;
}

case "xlXYScatterLinesNoMarkers ":
{
itype = xlXYScatter;
break;
}

case "xlXYScatterSmooth ":
{
itype = xlXYScatter;
break;
}

case "xlXYScatterSmoothNoMarkers":
{
itype = xlXYScatter;
break;
}

case "xlArea ":
{
itype = xlArea;
break;
}

case "xlAreaStacked ":
{
itype = xlAreaStacked;
break;
}

case "xlAreaStacked100 ":
{
itype = xlAreaStacked100;
break;
}

case "xl3DArea ":
{
itype = xlArea;
break;
}

case "xl3DAreaStacked ":
{
itype = xlAreaStacked;
break;
}

case "xl3DAreaStacked100 ":
{
itype = xlAreaStacked100;
break;
}

case "xlDoughnut ":
{
itype = xlPie;
break;
}

case "xlDoughnutExploded ":
{
itype = xlPie;
break;
}

case "xlRadar ":
{
itype = xlRadar;
break;
}

case "xlRadarMarkers ":
{
itype = xlRadarMarkers;
break;
}

case "xlRadarFilled ":
{
itype = xlRadarFilled;
break;
}

case "xlSurface ":
{
itype = xlArea;
break;
}

case "xlSurfaceWireframe ":
{
itype = xlArea;
break;
}

case "xlSurfaceTopView ":
{
itype = xlArea;
break;
}

case "xlSurfaceTopViewWireframe ":
{
itype = xlArea;
break;
}

case "xlBubble ":
{
itype = xlColumnClustered;
break;
}

case "xlBubble3DEffect ":
{
itype = xlColumnClustered;
break;
}

case "xlStockHLC ":
{
itype = xlStockHLC;
break;
}

case "xlStockVHLC ":
{
itype = xlStockVHLC;
break;
}

case "xlStockOHLC ":
{
itype = xlStockOHLC;
break;
}

case "xlStockVOHLC ":
{
itype = xlStockVOHLC;
break;
}

case "xlCylinderCol ":
{
itype = xlColumnClustered;
break;
}

case "xlCylinderBarClustered ":
{
itype = xlBarClustered;
break;
}

case "xlCylinderBarStacked ":
{
itype = xlBarStacked;
break;
}

case "xlCylinderBarStacked100 ":
{
itype = xlBarStacked100;
break;
}

case "xlCylinderColClustered ":
{
itype = xlColumnClustered;
break;
}

case "xlCylinderColStacked ":
{
itype = xlColumnStacked;
break;
}

case "xlCylinderColStacked100 ":
{
itype = xlColumnStacked100;
break;
}

case "xlConeBarClustered ":
{
itype = xlBarClustered;
break;
}

case "xlConeBarStacked ":
{
itype = xlBarStacked;
break;
}

case "xlConeBarStacked100 ":
{
itype = xlBarStacked100;
break;
}

case "xlConeCol ":
{
itype = xlBarStacked;
break;
}

case "xlConeColClustered ":
{
itype = xlColumnClustered;
break;
}

case "xlConeColStacked ":
{
itype = xlColumnStacked;
break;
}

case "xlConeColStacked100 ":
{
itype = xlColumnStacked100;
break;
}

case "xlPyramidBarClustered ":
{
itype = xlBarClustered;
break;
}

case "xlPyramidBarStacked ":
{
itype = xlBarStacked;
break;
}

case "xlPyramidBarStacked100 ":
{
itype = xlBarStacked100;
break;
}

case "xlPyramidCol ":
{
itype = xlColumnClustered;
break;
}

case "xlPyramidColClustered ":
{
itype = xlColumnClustered;
break;
}

case "xlPyramidColStacked ":
{
itype = xlBarStacked;
break;
}

case "xlPyramidColStacked100 ":
{
itype = xlColumnStacked100;
break;
}

default:
{
MsgBox("The chart type for the series " + iSeriesNo + " on the active chart is " + objSeries.ChartType.ToString + Constants.vbCrLf + "This chart type is not included on the list as yet!", Title: "ChartType_SeriesTypeConvert");
break;
}
}
ChartType_SeriesTypeConvert = itype;
}

// Call MsgBox("Chart type has been changed from " & _
// objSeries.ChartType.ToString & " to " & itype)

catch (Runtime.InteropServices.COMException objCOMException)
{
mobjCOMException = objCOMException;
}
catch (Exception objException)
{
mobjException = objException;
}

finally
{
objChart = null/* TODO Change to default(_) if this is not a reference type */;
objSeries = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(mobjCOMException) == false | IsNothing(mobjException) == false)))
clsError.Handle("ChartType_SeriesTypeConvert", msMODULENAME, "convert the chart type for series " + iSeriesNo + Constants.vbCrLf + "The current chart type is: " + objSeries.ChartType.ToString + ".", mobjCOMException, mobjException);
}
}
Public Function ChartSeries_Type_Convert(ByVal iSeriesNo As Integer) _
As Long

Dim objChart As Excel.Chart
Dim objSeries As Excel.Series

Try
If clsError.ErrorFlag() = True Then Exit Function

Dim itype As Integer

objChart = gApplication.ActiveChart
objSeries = CType(objChart.SeriesCollection(iSeriesNo), Excel.Series)

Select Case objSeries.ChartType.ToString & _
Space(26 - objSeries.ChartType.ToString.Length)

Case "xlColumnClustered " : itype = xlColumnClustered
Case "xlColumnStacked " : itype = xlColumnStacked
Case "xlColumnStacked100 " : itype = xlColumnStacked100
Case "xl3DColumnClustered " : itype = xlColumnClustered
Case "xl3DColumnStacked " : itype = xlColumnStacked
Case "xl3DColumnStacked100 " : itype = xlColumnStacked100
Case "xl3DColumn " : itype = xlColumnClustered
'---------------------------------------------
Case "xlBarClustered " : itype = xlBarClustered
Case "xlBarStacked " : itype = xlBarStacked
Case "xlBarStacked100 " : itype = xlBarStacked100
Case "xl3DBarClustered " : itype = xlBarClustered
Case "xl3DBarStacked " : itype = xlBarStacked
Case "xl3DBarStacked100 " : itype = xlBarStacked100
'---------------------------------------------
Case "xlLine " : itype = xlLine
Case "xlLineStacked " : itype = xlLine
Case "xlLineStacked100 " : itype = xlLine
Case "xlLineMarkers " : itype = xlLine
Case "xlLineMarkersStacked " : itype = xlLine
Case "xlLineMarkersStacked100 " : itype = xlLine
Case "xl3DLine " : itype = xlLine
'---------------------------------------------
Case "xlPie " : itype = xlPie
Case "xlPieExploded " : itype = xlPie
Case "xlPieOfPie " : itype = xlPie
Case "xl3DPie " : itype = xlPie
Case "xl3DPieExploded " : itype = xlPie
Case "xlBarOfPie " : itype = xlPie
'---------------------------------------------
Case "xlXYScatter " : itype = xlXYScatter
Case "xlXYScatterLines " : itype = xlXYScatter
Case "xlXYScatterLinesNoMarkers " : itype = xlXYScatter
Case "xlXYScatterSmooth " : itype = xlXYScatter
Case "xlXYScatterSmoothNoMarkers" : itype = xlXYScatter
'---------------------------------------------
Case "xlArea " : itype = xlArea
Case "xlAreaStacked " : itype = xlAreaStacked
Case "xlAreaStacked100 " : itype = xlAreaStacked100
Case "xl3DArea " : itype = xlArea
Case "xl3DAreaStacked " : itype = xlAreaStacked
Case "xl3DAreaStacked100 " : itype = xlAreaStacked100
'---------------------------------------------
Case "xlDoughnut " : itype = xlPie
Case "xlDoughnutExploded " : itype = xlPie
'---------------------------------------------
Case "xlRadar " : itype = xlRadar
Case "xlRadarMarkers " : itype = xlRadarMarkers
Case "xlRadarFilled " : itype = xlRadarFilled
'---------------------------------------------
Case "xlSurface " : itype = xlArea
Case "xlSurfaceWireframe " : itype = xlArea
Case "xlSurfaceTopView " : itype = xlArea
Case "xlSurfaceTopViewWireframe " : itype = xlArea
'---------------------------------------------
Case "xlBubble " : itype = xlColumnClustered
Case "xlBubble3DEffect " : itype = xlColumnClustered
'---------------------------------------------
Case "xlStockHLC " : itype = xlStockHLC
Case "xlStockVHLC " : itype = xlStockVHLC
Case "xlStockOHLC " : itype = xlStockOHLC
Case "xlStockVOHLC " : itype = xlStockVOHLC
'---------------------------------------------
Case "xlCylinderCol " : itype = xlColumnClustered
Case "xlCylinderBarClustered " : itype = xlBarClustered
Case "xlCylinderBarStacked " : itype = xlBarStacked
Case "xlCylinderBarStacked100 " : itype = xlBarStacked100
Case "xlCylinderColClustered " : itype = xlColumnClustered
Case "xlCylinderColStacked " : itype = xlColumnStacked
Case "xlCylinderColStacked100 " : itype = xlColumnStacked100
'---------------------------------------------
Case "xlConeBarClustered " : itype = xlBarClustered
Case "xlConeBarStacked " : itype = xlBarStacked
Case "xlConeBarStacked100 " : itype = xlBarStacked100
Case "xlConeCol " : itype = xlBarStacked
Case "xlConeColClustered " : itype = xlColumnClustered
Case "xlConeColStacked " : itype = xlColumnStacked
Case "xlConeColStacked100 " : itype = xlColumnStacked100
'---------------------------------------------
Case "xlPyramidBarClustered " : itype = xlBarClustered
Case "xlPyramidBarStacked " : itype = xlBarStacked
Case "xlPyramidBarStacked100 " : itype = xlBarStacked100
Case "xlPyramidCol " : itype = xlColumnClustered
Case "xlPyramidColClustered " : itype = xlColumnClustered
Case "xlPyramidColStacked " : itype = xlBarStacked
Case "xlPyramidColStacked100 " : itype = xlColumnStacked100
'---------------------------------------------

'Case xlbar : itype = xlColumnClustered
'Case xl3DBar: itype = xlBarClustered
'Case xl3D bar doesn't seem to exist

Case Else
Call MsgBox( _
"The chart type for the series " & iSeriesNo & _
" on the active chart is " & _
objSeries.ChartType.ToString & vbCrLf & _
"This chart type is not included on the list as yet!", , _
"ChartType_SeriesTypeConvert")
End Select
ChartType_SeriesTypeConvert = itype

'Call MsgBox("Chart type has been changed from " & _
' objSeries.ChartType.ToString & " to " & itype)

Catch objCOMException As System.Runtime.InteropServices.COMException
mobjCOMException = objCOMException
Catch objException As Exception
mobjException = objException

Finally
objChart = Nothing
objSeries = Nothing

If gbDEBUG = True Or _
((IsNothing(mobjCOMException) = False Or IsNothing(mobjException) = False)) Then

Call clsError.Handle("ChartType_SeriesTypeConvert", msMODULENAME, _
"convert the chart type for series " & iSeriesNo & vbCrLf & _
"The current chart type is: " & objSeries.ChartType.ToString & ".", _
mobjCOMException, mobjException)
End If
End Try
End Function

ChartSeries_Type_IsIt3D

public bool ChartSeries_Type_IsIt3D(Excel.Series objSeries)
{
try
{
if (clsError.ErrorFlag() == true)
return;

switch (objSeries.ChartType)
{
case object _ when xl3DArea:
case object _ when xl3DAreaStacked:
case object _ when xl3DAreaStacked100:
case object _ when xl3DBarClustered:
case object _ when xl3DBarStacked:
case object _ when xl3DBarStacked100:
case object _ when xl3DColumn:
case object _ when xl3DColumnClustered:
case object _ when xl3DColumnStacked:
case object _ when xl3DColumnStacked100:
case object _ when xl3DLine:
case object _ when xl3DPie:
case object _ when xl3DPieExploded:
case object _ when xlCylinderCol:
case object _ when xlCylinderBarClustered:
case object _ when xlCylinderBarStacked:
case object _ when xlCylinderBarStacked100:
case object _ when xlCylinderColClustered:
case object _ when xlCylinderColStacked:
case object _ when xlCylinderColStacked100:
case object _ when xlConeBarClustered:
case object _ when xlConeBarStacked:
case object _ when xlConeBarStacked100:
case object _ when xlConeCol:
case object _ when xlConeColClustered:
case object _ when xlConeColStacked:
case object _ when xlConeColStacked100:
case object _ when xlPyramidBarClustered:
case object _ when xlPyramidBarStacked:
case object _ when xlPyramidBarStacked100:
case object _ when xlPyramidCol:
case object _ when xlPyramidColClustered:
case object _ when xlPyramidColStacked:
case object _ when xlPyramidColStacked100:
{
ChartType_SeriesTypeIsIt3D = true;
break;
}

default:
{
ChartType_SeriesTypeIsIt3D = false;
break;
}
}
}

catch (Runtime.InteropServices.COMException objCOMException)
{
mobjCOMException = objCOMException;
}
catch (Exception objException)
{
mobjException = objException;
}

finally
{
objSeries = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(mobjCOMException) == false | IsNothing(mobjException) == false)))
clsError.Handle("ChartType_SeriesTypeIsIt3D", msMODULENAME, "determine if this series on the active chart" + " is a '3D' chart type.", mobjCOMException, mobjException);
}
}
Public Function ChartSeries_Type_IsIt3D(ByVal objSeries As Excel.Series) _
As Boolean

Try
If clsError.ErrorFlag() = True Then Exit Function

Select Case objSeries.ChartType
Case xl3DArea, _
xl3DAreaStacked, _
xl3DAreaStacked100, _
xl3DBarClustered, _
xl3DBarStacked, _
xl3DBarStacked100, _
xl3DColumn, _
xl3DColumnClustered, _
xl3DColumnStacked, _
xl3DColumnStacked100, _
xl3DLine, _
xl3DPie, _
xl3DPieExploded, _
xlCylinderCol, _
xlCylinderBarClustered, _
xlCylinderBarStacked, _
xlCylinderBarStacked100, _
xlCylinderColClustered, _
xlCylinderColStacked, _
xlCylinderColStacked100, _
xlConeBarClustered, _
xlConeBarStacked, _
xlConeBarStacked100, _
xlConeCol, _
xlConeColClustered, _
xlConeColStacked, _
xlConeColStacked100, _
xlPyramidBarClustered, _
xlPyramidBarStacked, _
xlPyramidBarStacked100, _
xlPyramidCol, _
xlPyramidColClustered, _
xlPyramidColStacked, _
xlPyramidColStacked100

ChartType_SeriesTypeIsIt3D = True
Case Else
ChartType_SeriesTypeIsIt3D = False
End Select


Catch objCOMException As System.Runtime.InteropServices.COMException
mobjCOMException = objCOMException
Catch objException As Exception
mobjException = objException

Finally
objSeries = Nothing

If gbDEBUG = True Or _
((IsNothing(mobjCOMException) = False Or IsNothing(mobjException) = False)) Then

Call clsError.Handle("ChartType_SeriesTypeIsIt3D", msMODULENAME, _
"determine if this series on the active chart" & _
" is a '3D' chart type.", _
mobjCOMException, mobjException)
End If

End Try
End Function

ChartSeries_Type_IsItBubble

public bool ChartSeries_Type_IsItBubble(Excel.Series objSeries)
{
try
{
if (clsError.ErrorFlag() == true)
return;

switch (objSeries.ChartType)
{
case object _ when xlBubble:
case object _ when xlBubble3DEffect:
{
ChartType_SeriesTypeIsItBubble = true;
break;
}

default:
{
ChartType_SeriesTypeIsItBubble = false;
break;
}
}
}
catch (Runtime.InteropServices.COMException objCOMException)
{
mobjCOMException = objCOMException;
}
catch (Exception objException)
{
mobjException = objException;
}

finally
{
objSeries = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(mobjCOMException) == false | IsNothing(mobjException) == false)))
clsError.Handle("ChartType_SeriesTypeIsItBubble", msMODULENAME, "determine if this series on the active chart" + " is a 'Bubble' chart type.", mobjCOMException, mobjException);
}
}
Public Function ChartSeries_Type_IsItBubble(ByVal objSeries As Excel.Series) _
As Boolean

Try
If clsError.ErrorFlag() = True Then Exit Function

Select Case objSeries.ChartType
Case xlBubble, _
xlBubble3DEffect

ChartType_SeriesTypeIsItBubble = True
Case Else
ChartType_SeriesTypeIsItBubble = False
End Select

Catch objCOMException As System.Runtime.InteropServices.COMException
mobjCOMException = objCOMException
Catch objException As Exception
mobjException = objException

Finally
objSeries = Nothing

If gbDEBUG = True Or _
((IsNothing(mobjCOMException) = False Or IsNothing(mobjException) = False)) Then

Call clsError.Handle("ChartType_SeriesTypeIsItBubble", msMODULENAME, _
"determine if this series on the active chart" & _
" is a 'Bubble' chart type.", _
mobjCOMException, mobjException)
End If

End Try
End Function

ChartSeries_Type_IsItDoughnut

public bool ChartSeries_Type_IsItDoughnut(Excel.Series objSeries)
{
try
{
if (clsError.ErrorFlag() == true)
return;

switch (objSeries.ChartType)
{
case object _ when xlDoughnut:
case object _ when xlDoughnutExploded:
{
ChartType_SeriesTypeIsItDoughnut = true;
break;
}

default:
{
ChartType_SeriesTypeIsItDoughnut = false;
break;
}
}
}
catch (Runtime.InteropServices.COMException objCOMException)
{
mobjCOMException = objCOMException;
}
catch (Exception objException)
{
mobjException = objException;
}

finally
{
objSeries = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(mobjCOMException) == false | IsNothing(mobjException) == false)))
clsError.Handle("ChartType_SeriesTypeIsItDoughnut", msMODULENAME, "determine if this series on the active chart" + " is a 'Doughnut' chart type.", mobjCOMException, mobjException);
}
}
Public Function ChartSeries_Type_IsItDoughnut(ByVal objSeries As Excel.Series) _
As Boolean

Try
If clsError.ErrorFlag() = True Then Exit Function

Select Case objSeries.ChartType
Case xlDoughnut, _
xlDoughnutExploded

ChartType_SeriesTypeIsItDoughnut = True
Case Else
ChartType_SeriesTypeIsItDoughnut = False
End Select

Catch objCOMException As System.Runtime.InteropServices.COMException
mobjCOMException = objCOMException
Catch objException As Exception
mobjException = objException

Finally
objSeries = Nothing

If gbDEBUG = True Or _
((IsNothing(mobjCOMException) = False Or IsNothing(mobjException) = False)) Then

Call clsError.Handle("ChartType_SeriesTypeIsItDoughnut", msMODULENAME, _
"determine if this series on the active chart" & _
" is a 'Doughnut' chart type.", _
mobjCOMException, mobjException)
End If

End Try
End Function

ChartSeries_Type_IsItPie

public bool ChartSeries_Type_IsItPie(Excel.Series objSeries)
{
try
{
if (clsError.ErrorFlag() == true)
return;

switch (objSeries.ChartType)
{
case object _ when xlPie:
case object _ when xlPieOfPie:
case object _ when xlBarOfPie:
case object _ when xlPieExploded:
case object _ when xl3DPie:
case object _ when xl3DPieExploded:
{
ChartType_SeriesTypeIsItPie = true;
break;
}

default:
{
ChartType_SeriesTypeIsItPie = false;
break;
}
}
}

catch (Runtime.InteropServices.COMException objCOMException)
{
mobjCOMException = objCOMException;
}
catch (Exception objException)
{
mobjException = objException;
}

finally
{
objSeries = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(mobjCOMException) == false | IsNothing(mobjException) == false)))
clsError.Handle("Chart_SeriesTypeIsItPie", msMODULENAME, "determine if this series on the active chart" + " is a 'Pie' chart type.", mobjCOMException, mobjException);
}
}
Public Function ChartSeries_Type_IsItPie(ByVal objSeries As Excel.Series) _
As Boolean

Try
If clsError.ErrorFlag() = True Then Exit Function

Select Case objSeries.ChartType
Case xlPie, _
xlPieOfPie, _
xlBarOfPie, _
xlPieExploded, _
xl3DPie, _
xl3DPieExploded

ChartType_SeriesTypeIsItPie = True
Case Else
ChartType_SeriesTypeIsItPie = False
End Select


Catch objCOMException As System.Runtime.InteropServices.COMException
mobjCOMException = objCOMException
Catch objException As Exception
mobjException = objException

Finally
objSeries = Nothing

If gbDEBUG = True Or _
((IsNothing(mobjCOMException) = False Or IsNothing(mobjException) = False)) Then

Call clsError.Handle("Chart_SeriesTypeIsItPie", msMODULENAME, _
"determine if this series on the active chart" & _
" is a 'Pie' chart type.", _
mobjCOMException, mobjException)
End If

End Try
End Function

ChartSeries_Type_IsItStacked

public bool ChartSeries_Type_IsItStacked(Excel.Series objSeries)
{
try
{
if (clsError.ErrorFlag() == true)
return;

switch (objSeries.ChartType)
{
case object _ when xlAreaStacked:
case object _ when xl3DAreaStacked:
case object _ when xlBarStacked:
case object _ when xl3DBarStacked:
case object _ when xlColumnStacked:
case object _ when xl3DColumnStacked:
case object _ when xlConeBarStacked:
case object _ when xlConeColStacked:
case object _ when xlCylinderBarStacked:
case object _ when xlCylinderColStacked:
case object _ when xlLineMarkersStacked:
case object _ when xlLineStacked:
case object _ when xlPyramidBarStacked:
case object _ when xlPyramidColStacked:
{
ChartType_SeriesTypeIsItStacked = true;
break;
}

default:
{
ChartType_SeriesTypeIsItStacked = false;
break;
}
}
}
catch (Runtime.InteropServices.COMException objCOMException)
{
mobjCOMException = objCOMException;
}
catch (Exception objException)
{
mobjException = objException;
}

finally
{
objSeries = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(mobjCOMException) == false | IsNothing(mobjException) == false)))
clsError.Handle("Chart_SeriesTypeIsItStacked", msMODULENAME, "determine if this series on the active chart" + " is a 'Stacked' chart type.", mobjCOMException, mobjException);
}
}
Public Function ChartSeries_Type_IsItStacked(ByVal objSeries As Excel.Series) _
As Boolean

Try
If clsError.ErrorFlag() = True Then Exit Function

Select Case objSeries.ChartType

Case xlAreaStacked, _
xl3DAreaStacked, _
xlBarStacked, _
xl3DBarStacked, _
xlColumnStacked, _
xl3DColumnStacked, _
xlConeBarStacked, _
xlConeColStacked, _
xlCylinderBarStacked, _
xlCylinderColStacked, _
xlLineMarkersStacked, _
xlLineStacked, _
xlPyramidBarStacked, _
xlPyramidColStacked

ChartType_SeriesTypeIsItStacked = True
Case Else
ChartType_SeriesTypeIsItStacked = False
End Select

Catch objCOMException As System.Runtime.InteropServices.COMException
mobjCOMException = objCOMException
Catch objException As Exception
mobjException = objException

Finally
objSeries = Nothing

If gbDEBUG = True Or _
((IsNothing(mobjCOMException) = False Or IsNothing(mobjException) = False)) Then

Call clsError.Handle("Chart_SeriesTypeIsItStacked", msMODULENAME, _
"determine if this series on the active chart" & _
" is a 'Stacked' chart type.", _
mobjCOMException, mobjException)
End If

End Try
End Function

ChartSeries_Type_IsItStacked100

public bool ChartSeries_Type_IsItStacked100(Excel.Series objSeries)
{
try
{
if (clsError.ErrorFlag() == true)
return;

if (ChartType_SeriesTypeIsItStacked100Horizontal(objSeries) | ChartType_SeriesTypeIsItStacked100Vertical(objSeries))
ChartType_SeriesTypeIsItStacked100 = true;
else
ChartType_SeriesTypeIsItStacked100 = false;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
mobjCOMException = objCOMException;
}
catch (Exception objException)
{
mobjException = objException;
}

finally
{
objSeries = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(mobjCOMException) == false | IsNothing(mobjException) == false)))
clsError.Handle("ChartType_SeriesTypeIsItStacked100", msMODULENAME, "determine if this series on the active chart" + " is a 'Stacked 100' chart type.", mobjCOMException, mobjException);
}
}
Public Function ChartSeries_Type_IsItStacked100(ByVal objSeries As Excel.Series) _
As Boolean

Try
If clsError.ErrorFlag() = True Then Exit Function

If ChartType_SeriesTypeIsItStacked100Horizontal(objSeries) Or _
ChartType_SeriesTypeIsItStacked100Vertical(objSeries) Then
ChartType_SeriesTypeIsItStacked100 = True
Else
ChartType_SeriesTypeIsItStacked100 = False
End If

Catch objCOMException As System.Runtime.InteropServices.COMException
mobjCOMException = objCOMException
Catch objException As Exception
mobjException = objException

Finally
objSeries = Nothing

If gbDEBUG = True Or _
((IsNothing(mobjCOMException) = False Or IsNothing(mobjException) = False)) Then

Call clsError.Handle("ChartType_SeriesTypeIsItStacked100", msMODULENAME, _
"determine if this series on the active chart" & _
" is a 'Stacked 100' chart type.", _
mobjCOMException, mobjException)
End If
End Try
End Function

ChartSeries_Type_IsItStacked100Horizontal

public bool ChartSeries_Type_IsItStacked100Horizontal(Excel.Series objSeries)
{
try
{
if (clsError.ErrorFlag() == true)
return;

switch (objSeries.ChartType)
{
case object _ when xlBarStacked100:
case object _ when xl3DBarStacked100:
case object _ when xlConeBarStacked100:
case object _ when xlCylinderBarStacked100:
case object _ when xlPyramidBarStacked100:
{
ChartType_SeriesTypeIsItStacked100Horizontal = true;
break;
}

default:
{
ChartType_SeriesTypeIsItStacked100Horizontal = false;
break;
}
}
}
catch (Runtime.InteropServices.COMException objCOMException)
{
mobjCOMException = objCOMException;
}
catch (Exception objException)
{
mobjException = objException;
}

finally
{
objSeries = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(mobjCOMException) == false | IsNothing(mobjException) == false)))
clsError.Handle("Chart_SeriesTypeIsItStacked100Horizontal", msMODULENAME, "determine if this series on the active chart" + " is a 'Horizontally Stacked' chart type.", mobjCOMException, mobjException);
}
}
Public Function ChartSeries_Type_IsItStacked100Horizontal(ByVal objSeries As Excel.Series) _
As Boolean

Try
If clsError.ErrorFlag() = True Then Exit Function

Select Case objSeries.ChartType
Case xlBarStacked100, _
xl3DBarStacked100, _
xlConeBarStacked100, _
xlCylinderBarStacked100, _
xlPyramidBarStacked100

ChartType_SeriesTypeIsItStacked100Horizontal = True
Case Else
ChartType_SeriesTypeIsItStacked100Horizontal = False
End Select

Catch objCOMException As System.Runtime.InteropServices.COMException
mobjCOMException = objCOMException
Catch objException As Exception
mobjException = objException

Finally
objSeries = Nothing

If gbDEBUG = True Or _
((IsNothing(mobjCOMException) = False Or IsNothing(mobjException) = False)) Then

Call clsError.Handle("Chart_SeriesTypeIsItStacked100Horizontal", msMODULENAME, _
"determine if this series on the active chart" & _
" is a 'Horizontally Stacked' chart type.", _
mobjCOMException, mobjException)
End If
End Try
End Function

ChartSeries_Type_IsItStacked100Vertical

public bool ChartSeries_Type_IsItStacked100Vertical(Excel.Series objSeries)
{
try
{
if (clsError.ErrorFlag() == true)
return;

switch (objSeries.ChartType)
{
case object _ when xlAreaStacked100:
case object _ when xl3DAreaStacked100:
case object _ when xlColumnStacked100:
case object _ when xl3DColumnStacked100:
case object _ when xlConeColStacked100:
case object _ when xlCylinderColStacked100:
case object _ when xlLineMarkersStacked100:
case object _ when xlPyramidColStacked100:
{
ChartType_SeriesTypeIsItStacked100Vertical = true;
break;
}

default:
{
ChartType_SeriesTypeIsItStacked100Vertical = false;
break;
}
}
}
catch (Runtime.InteropServices.COMException objCOMException)
{
mobjCOMException = objCOMException;
}
catch (Exception objException)
{
mobjException = objException;
}

finally
{
objSeries = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(mobjCOMException) == false | IsNothing(mobjException) == false)))
clsError.Handle("Chart_SeriesTypeIsItStacked100Vertical", msMODULENAME, "determine if this series on the active chart" + " is a 'Vertically Stacked' chart type", mobjCOMException, mobjException);
}
}
Public Function ChartSeries_Type_IsItStacked100Vertical(ByVal objSeries As Excel.Series) _
As Boolean

Try
If clsError.ErrorFlag() = True Then Exit Function

Select Case objSeries.ChartType
Case xlAreaStacked100, _
xl3DAreaStacked100, _
xlColumnStacked100, _
xl3DColumnStacked100, _
xlConeColStacked100, _
xlCylinderColStacked100, _
xlLineMarkersStacked100, _
xlPyramidColStacked100

ChartType_SeriesTypeIsItStacked100Vertical = True
Case Else
ChartType_SeriesTypeIsItStacked100Vertical = False
End Select

Catch objCOMException As System.Runtime.InteropServices.COMException
mobjCOMException = objCOMException
Catch objException As Exception
mobjException = objException

Finally
objSeries = Nothing

If gbDEBUG = True Or _
((IsNothing(mobjCOMException) = False Or IsNothing(mobjException) = False)) Then

Call clsError.Handle("Chart_SeriesTypeIsItStacked100Vertical", msMODULENAME, _
"determine if this series on the active chart" & _
" is a 'Vertically Stacked' chart type", _
mobjCOMException, mobjException)
End If
End Try
End Function

ChartSeries_Type_IsItSurface

public bool ChartSeries_Type_IsItSurface(Excel.Series objSeries)
{
try
{
if (clsError.ErrorFlag() == true)
return;

switch (objSeries.ChartType)
{
case object _ when xlSurface:
case object _ when xlSurfaceWireframe:
case object _ when xlSurfaceTopView:
{
ChartType_SeriesTypeIsItSurface = true;
break;
}

default:
{
ChartType_SeriesTypeIsItSurface = false;
break;
}
}
}
catch (Runtime.InteropServices.COMException objCOMException)
{
mobjCOMException = objCOMException;
}
catch (Exception objException)
{
mobjException = objException;
}

finally
{
objSeries = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(mobjCOMException) == false | IsNothing(mobjException) == false)))
clsError.Handle("ChartType_SeriesTypeIsItSurface", msMODULENAME, "determine if this series on the active chart" + " is a 'Surface' chart type", mobjCOMException, mobjException);
}
}
Public Function ChartSeries_Type_IsItSurface(ByVal objSeries As Excel.Series) _
As Boolean

Try
If clsError.ErrorFlag() = True Then Exit Function

Select Case objSeries.ChartType
Case xlSurface, _
xlSurfaceWireframe, _
xlSurfaceTopView

ChartType_SeriesTypeIsItSurface = True
'xlsurfacetopviewwireframe: 'doesn't seem to recognise ??????
Case Else
ChartType_SeriesTypeIsItSurface = False
End Select

Catch objCOMException As System.Runtime.InteropServices.COMException
mobjCOMException = objCOMException
Catch objException As Exception
mobjException = objException

Finally
objSeries = Nothing

If gbDEBUG = True Or _
((IsNothing(mobjCOMException) = False Or IsNothing(mobjException) = False)) Then

Call clsError.Handle("ChartType_SeriesTypeIsItSurface", msMODULENAME, _
"determine if this series on the active chart" & _
" is a 'Surface' chart type", _
mobjCOMException, mobjException)
End If
End Try
End Function

ChartSeries_Type_NameToEnumeration

public Excel.XlChartType ChartSeries_Type_NameToEnumeration(string sChartTypeName)
{
Excel.XlChartType lreturn;

try
{
if (clsError.ErrorFlag() == true)
return;

switch (sChartTypeName + Strings.Space(30 - sChartTypeName.Length))
{
case "Area ":
{
lreturn = xlArea;
break;
}

case "Area - Stacked ":
{
lreturn = xlAreaStacked;
break;
}

case "Area - Stacked 100 ":
{
lreturn = xlAreaStacked100;
break;
}

case "Area - 3D ":
{
lreturn = xl3DArea;
break;
}

case "Area - 3D Stacked ":
{
lreturn = xl3DAreaStacked;
break;
}

case "Area - 3D Stacked 100 ":
{
lreturn = xl3DAreaStacked100;
break;
}

case "Bar - Clustered ":
{
lreturn = xlBarClustered;
break;
}

case "Bar - Clustered Cone ":
{
lreturn = xlConeBarClustered;
break;
}

case "Bar - Clustered Cylinder ":
{
lreturn = xlCylinderBarClustered;
break;
}

case "Bar - Clustered Pyramid ":
{
lreturn = xlPyramidBarClustered;
break;
}

case "Bar - Stacked ":
{
lreturn = xlBarStacked;
break;
}

case "Bar - Stacked Cone ":
{
lreturn = xlConeBarStacked;
break;
}

case "Bar - Stacked Cylinder ":
{
lreturn = xlCylinderBarStacked;
break;
}

case "Bar - Stacked Pyramid ":
{
lreturn = xlPyramidBarStacked;
break;
}

case "Bar - Stacked 100 ":
{
lreturn = xlBarStacked100;
break;
}

case "Bar - Stacked Cone 100 ":
{
lreturn = xlConeBarStacked100;
break;
}

case "Bar - Stacked Cylinder 100 ":
{
lreturn = xlCylinderBarStacked100;
break;
}

case "Bar - Stacked Pyramid 100 ":
{
lreturn = xlPyramidBarStacked100;
break;
}

case "Bar - 3D Clustered ":
{
lreturn = xl3DBarClustered;
break;
}

case "Bar - 3D Stacked ":
{
lreturn = xl3DBarStacked;
break;
}

case "Bar - 3D Stacked 100 ":
{
lreturn = xl3DBarStacked100;
break;
}

case "Bubble ":
{
lreturn = xlBubble;
break;
}

case "Bubble - 3D ":
{
lreturn = xlBubble3DEffect;
break;
}

case "Column - Clustered ":
{
lreturn = xlColumnClustered;
break;
}

case "Column - Clustered Cone ":
{
lreturn = xlConeColClustered;
break;
}

case "Column - Clustered Cylinder ":
{
lreturn = xlCylinderColClustered;
break;
}

case "Column - Clustered Pyramid ":
{
lreturn = xlPyramidColClustered;
break;
}

case "Column - Stacked ":
{
lreturn = xlColumnStacked;
break;
}

case "Column - Stacked Cone ":
{
lreturn = xlConeColStacked;
break;
}

case "Column - Stacked Cylinder ":
{
lreturn = xlCylinderColStacked;
break;
}

case "Column - Stacked Pyramid ":
{
lreturn = xlPyramidColStacked;
break;
}

case "Column - Stacked 100 ":
{
lreturn = xlColumnStacked100;
break;
}

case "Column - Stacked Cone 100 ":
{
lreturn = xlConeColStacked100;
break;
}

case "Column - Stacked Cylinder 100 ":
{
lreturn = xlCylinderColStacked100;
break;
}

case "Column - Stacked Pyramid 100 ":
{
lreturn = xlPyramidColStacked100;
break;
}

case "Column - 3D ":
{
lreturn = xl3DColumn;
break;
}

case "Column - 3D Clustered ":
{
lreturn = xl3DColumnClustered;
break;
}

case "Column - 3D Stacked ":
{
lreturn = xl3DColumnStacked;
break;
}

case "Column - 3D Stacked 100 ":
{
lreturn = xl3DColumnStacked100;
break;
}

case "Doughnut ":
{
lreturn = xlDoughnut;
break;
}

case "Doughnut - Exploded ":
{
lreturn = xlDoughnutExploded;
break;
}

case "Line ":
{
lreturn = xlLine;
break;
}

case "Line - Stacked ":
{
lreturn = xlLineStacked;
break;
}

case "Line - Stacked 100 ":
{
lreturn = xlLineStacked100;
break;
}

case "Line - Markers ":
{
lreturn = xlLineMarkers;
break;
}

case "Line - Markers Stacked ":
{
lreturn = xlLineMarkersStacked;
break;
}

case "Line - Markers Stacked 100 ":
{
lreturn = xlLineMarkersStacked100;
break;
}

case "Line - 3D ":
{
lreturn = xl3DLine;
break;
}

case "Pie ":
{
lreturn = xlPie;
break;
}

case "Pie - Exploded ":
{
lreturn = xlPieExploded;
break;
}

case "Pie - Of Pie ":
{
lreturn = xlPieOfPie;
break;
}

case "Pie - 3D ":
{
lreturn = xl3DPie;
break;
}

case "Pie - 3D Exploded ":
{
lreturn = xl3DPieExploded;
break;
}

case "Radar ":
{
lreturn = xlRadar;
break;
}

case "Radar - Markers ":
{
lreturn = xlRadarMarkers;
break;
}

case "Radar - Filled ":
{
lreturn = xlRadarFilled;
break;
}

case "Stock - High Low Close ":
{
lreturn = xlStockHLC;
break;
}

case "Stock - V High Low Close ":
{
lreturn = xlStockVHLC;
break;
}

case "Stock - O High Low Close ":
{
lreturn = xlStockOHLC;
break;
}

case "Stock - V O High Low Close ":
{
lreturn = xlStockVOHLC;
break;
}

case "Scatter XY ":
{
lreturn = xlXYScatter;
break;
}

case "Scatter XY - Lines ":
{
lreturn = xlXYScatterLines;
break;
}

case "Scatter XY - Lines No Markers ":
{
lreturn = xlXYScatterLinesNoMarkers;
break;
}

case "Scatter XY - Smooth ":
{
lreturn = xlXYScatterSmooth;
break;
}

case "Scatter XY - Smooth No Markers":
{
lreturn = xlXYScatterSmoothNoMarkers;
break;
}

case "Surface ":
{
lreturn = xlSurface;
break;
}

case "Surface - WireFrame ":
{
lreturn = xlSurfaceWireframe;
break;
}

case "Surface (TopView) ":
{
lreturn = xlSurfaceTopView;
break;
}

case "Surface - WireFrame (Top view)":
{
lreturn = xlSurfaceTopViewWireframe;
break;
}

default:
{
MsgBox("Incorrect Chart Type name : " + sChartTypeName, Title: "ChartType_NameReturnType");
break;
}
}

// Surface Top View ???

ChartType_ReturnChartType = lreturn;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
mobjCOMException = objCOMException;
}
catch (Exception objException)
{
mobjException = objException;
}

finally
{
lreturn = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(mobjCOMException) == false | IsNothing(mobjException) == false)))
clsError.Handle("ChartType_ReturnChartType", msMODULENAME, "return the corresponding chart type for '" + sChartTypeName + "'.", mobjCOMException, mobjException);
}
}
Public Function ChartSeries_Type_NameToEnumeration(ByVal sChartTypeName As String) _
As Excel.XlChartType

Dim lreturn As Excel.XlChartType

Try
If clsError.ErrorFlag() = True Then Exit Function

Select Case sChartTypeName & Space(30 - sChartTypeName.Length)
Case "Area " : lreturn = xlArea
Case "Area - Stacked " : lreturn = xlAreaStacked
Case "Area - Stacked 100 " : lreturn = xlAreaStacked100
Case "Area - 3D " : lreturn = xl3DArea
Case "Area - 3D Stacked " : lreturn = xl3DAreaStacked
Case "Area - 3D Stacked 100 " : lreturn = xl3DAreaStacked100
Case "Bar - Clustered " : lreturn = xlBarClustered
Case "Bar - Clustered Cone " : lreturn = xlConeBarClustered
Case "Bar - Clustered Cylinder " : lreturn = xlCylinderBarClustered
Case "Bar - Clustered Pyramid " : lreturn = xlPyramidBarClustered
Case "Bar - Stacked " : lreturn = xlBarStacked
Case "Bar - Stacked Cone " : lreturn = xlConeBarStacked
Case "Bar - Stacked Cylinder " : lreturn = xlCylinderBarStacked
Case "Bar - Stacked Pyramid " : lreturn = xlPyramidBarStacked
Case "Bar - Stacked 100 " : lreturn = xlBarStacked100
Case "Bar - Stacked Cone 100 " : lreturn = xlConeBarStacked100
Case "Bar - Stacked Cylinder 100 " : lreturn = xlCylinderBarStacked100
Case "Bar - Stacked Pyramid 100 " : lreturn = xlPyramidBarStacked100
Case "Bar - 3D Clustered " : lreturn = xl3DBarClustered
Case "Bar - 3D Stacked " : lreturn = xl3DBarStacked
Case "Bar - 3D Stacked 100 " : lreturn = xl3DBarStacked100
Case "Bubble " : lreturn = xlBubble
Case "Bubble - 3D " : lreturn = xlBubble3DEffect
Case "Column - Clustered " : lreturn = xlColumnClustered
Case "Column - Clustered Cone " : lreturn = xlConeColClustered
Case "Column - Clustered Cylinder " : lreturn = xlCylinderColClustered
Case "Column - Clustered Pyramid " : lreturn = xlPyramidColClustered
Case "Column - Stacked " : lreturn = xlColumnStacked
Case "Column - Stacked Cone " : lreturn = xlConeColStacked
Case "Column - Stacked Cylinder " : lreturn = xlCylinderColStacked
Case "Column - Stacked Pyramid " : lreturn = xlPyramidColStacked
Case "Column - Stacked 100 " : lreturn = xlColumnStacked100
Case "Column - Stacked Cone 100 " : lreturn = xlConeColStacked100
Case "Column - Stacked Cylinder 100 " : lreturn = xlCylinderColStacked100
Case "Column - Stacked Pyramid 100 " : lreturn = xlPyramidColStacked100
Case "Column - 3D " : lreturn = xl3DColumn
Case "Column - 3D Clustered " : lreturn = xl3DColumnClustered
Case "Column - 3D Stacked " : lreturn = xl3DColumnStacked
Case "Column - 3D Stacked 100 " : lreturn = xl3DColumnStacked100
Case "Doughnut " : lreturn = xlDoughnut
Case "Doughnut - Exploded " : lreturn = xlDoughnutExploded
Case "Line " : lreturn = xlLine
Case "Line - Stacked " : lreturn = xlLineStacked
Case "Line - Stacked 100 " : lreturn = xlLineStacked100
Case "Line - Markers " : lreturn = xlLineMarkers
Case "Line - Markers Stacked " : lreturn = xlLineMarkersStacked
Case "Line - Markers Stacked 100 " : lreturn = xlLineMarkersStacked100
Case "Line - 3D " : lreturn = xl3DLine
Case "Pie " : lreturn = xlPie
Case "Pie - Exploded " : lreturn = xlPieExploded
Case "Pie - Of Pie " : lreturn = xlPieOfPie
Case "Pie - 3D " : lreturn = xl3DPie
Case "Pie - 3D Exploded " : lreturn = xl3DPieExploded
Case "Radar " : lreturn = xlRadar
Case "Radar - Markers " : lreturn = xlRadarMarkers
Case "Radar - Filled " : lreturn = xlRadarFilled
Case "Stock - High Low Close " : lreturn = xlStockHLC
Case "Stock - V High Low Close " : lreturn = xlStockVHLC
Case "Stock - O High Low Close " : lreturn = xlStockOHLC
Case "Stock - V O High Low Close " : lreturn = xlStockVOHLC
Case "Scatter XY " : lreturn = xlXYScatter
Case "Scatter XY - Lines " : lreturn = xlXYScatterLines
Case "Scatter XY - Lines No Markers " : lreturn = xlXYScatterLinesNoMarkers
Case "Scatter XY - Smooth " : lreturn = xlXYScatterSmooth
Case "Scatter XY - Smooth No Markers" : lreturn = xlXYScatterSmoothNoMarkers
Case "Surface " : lreturn = xlSurface
Case "Surface - WireFrame " : lreturn = xlSurfaceWireframe
Case "Surface (TopView) " : lreturn = xlSurfaceTopView
Case "Surface - WireFrame (Top view)" : lreturn = xlSurfaceTopViewWireframe

Case Else
Call MsgBox("Incorrect Chart Type name : " & sChartTypeName, , _
"ChartType_NameReturnType")
End Select

'Surface Top View ???

ChartType_ReturnChartType = lreturn

Catch objCOMException As System.Runtime.InteropServices.COMException
mobjCOMException = objCOMException
Catch objException As Exception
mobjException = objException

Finally
lreturn = Nothing

If gbDEBUG = True Or _
((IsNothing(mobjCOMException) = False Or IsNothing(mobjException) = False)) Then

Call clsError.Handle("ChartType_ReturnChartType", msMODULENAME, _
"return the corresponding chart type for '" & sChartTypeName & "'.", _
mobjCOMException, mobjException)
End If
End Try
End Function

ChartSeries_Type_ReturnCategory

public string ChartSeries_Type_ReturnCategory(Excel.Series objSeries)
{
try
{
if (clsError.ErrorFlag() == true)
return;

switch (objSeries.ChartType)
{
case object _ when xlColumnClustered:
case object _ when xlColumnStacked:
case object _ when xlColumnStacked100:
case object _ when xl3DColumn:
case object _ when xl3DColumnClustered:
case object _ when xl3DColumnStacked:
case object _ when xl3DColumnStacked100:
{
ChartType_ReturnCategory = "Column";
break;
}

case object _ when xlBarClustered:
case object _ when xlBarStacked:
case object _ when xlBarStacked100:
case object _ when xl3DBarClustered:
case object _ when xl3DBarStacked:
case object _ when xl3DBarStacked100:
{
ChartType_ReturnCategory = "Bar";
break;
}

case object _ when xlLine:
case object _ when xlLineStacked:
case object _ when xlLineStacked100:
case object _ when xlLineMarkers:
case object _ when xlLineMarkersStacked:
case object _ when xlLineMarkersStacked100:
case object _ when xl3DLine:
{
ChartType_ReturnCategory = "Line";
break;
}

case object _ when xlBarOfPie:
case object _ when xlPie:
case object _ when xlPieExploded:
case object _ when xlPieOfPie:
case object _ when xl3DPie:
case object _ when xl3DPieExploded:
{
ChartType_ReturnCategory = "Pie";
break;
}

case object _ when xlXYScatter:
case object _ when xlXYScatterLines:
case object _ when xlXYScatterLinesNoMarkers:
case object _ when xlXYScatterSmooth:
case object _ when xlXYScatterSmoothNoMarkers:
{
ChartType_ReturnCategory = "Scatter";
break;
}

case object _ when xlArea:
case object _ when xlAreaStacked:
case object _ when xlAreaStacked100:
case object _ when xl3DArea:
case object _ when xl3DAreaStacked:
case object _ when xl3DAreaStacked100:
{
ChartType_ReturnCategory = "Area";
break;
}

case object _ when xlDoughnut:
case object _ when xlDoughnutExploded:
{
ChartType_ReturnCategory = "Doughnut";
break;
}

case object _ when xlRadar:
case object _ when xlRadarMarkers:
case object _ when xlRadarFilled:
{
ChartType_ReturnCategory = "Radar";
break;
}

case object _ when xlSurface:
case object _ when xlSurfaceTopView:
case object _ when xlSurfaceTopViewWireframe:
case object _ when xlSurfaceWireframe:
{
ChartType_ReturnCategory = "Surface";
break;
}

case object _ when xlBubble:
case object _ when xlBubble3DEffect:
{
ChartType_ReturnCategory = "Bubble";
break;
}

case object _ when xlStockHLC:
case object _ when xlStockVHLC:
case object _ when xlStockOHLC:
case object _ when xlStockVOHLC:
{
ChartType_ReturnCategory = "Stock";
break;
}

case object _ when xlCylinderBarClustered:
case object _ when xlCylinderBarStacked:
case object _ when xlCylinderBarStacked100:
case object _ when xlCylinderColClustered:
case object _ when xlCylinderColStacked:
case object _ when xlCylinderColStacked100:
{
ChartType_ReturnCategory = "Cylinder";
break;
}

case object _ when xlConeBarClustered:
case object _ when xlConeBarStacked:
case object _ when xlConeBarStacked100:
case object _ when xlConeColClustered:
case object _ when xlConeColStacked:
case object _ when xlConeColStacked100:
{
ChartType_ReturnCategory = "Cone";
break;
}

case object _ when xlPyramidCol:
case object _ when xlPyramidBarClustered:
case object _ when xlPyramidBarStacked:
case object _ when xlPyramidBarStacked100:
case object _ when xlPyramidColClustered:
case object _ when xlPyramidColStacked:
case object _ when xlPyramidColStacked100:
{
ChartType_ReturnCategory = "Pyramid";
break;
}

default:
{
MsgBox("Incorrect Chart Type number : " + objSeries.ChartType.ToString, Title: "Chart_TypeReturn");
break;
}
}
}

catch (Runtime.InteropServices.COMException objCOMException)
{
mobjCOMException = objCOMException;
}
catch (Exception objException)
{
mobjException = objException;
}

finally
{
if (gbDEBUG == true | ((IsNothing(mobjCOMException) == false | IsNothing(mobjException) == false)))
clsError.Handle("Chart_TypeReturn", msMODULENAME, "return the category name for the series '" + objSeries.Name + "'.", mobjCOMException, mobjException);
}
}
Public Function ChartSeries_Type_ReturnCategory(ByVal objSeries As Excel.Series) _
As String

Try
If clsError.ErrorFlag() = True Then Exit Function

Select Case objSeries.ChartType
Case xlColumnClustered, _
xlColumnStacked, _
xlColumnStacked100, _
xl3DColumn, _
xl3DColumnClustered, _
xl3DColumnStacked, _
xl3DColumnStacked100 : ChartType_ReturnCategory = "Column"

Case xlBarClustered, _
xlBarStacked, _
xlBarStacked100, _
xl3DBarClustered, _
xl3DBarStacked, _
xl3DBarStacked100 : ChartType_ReturnCategory = "Bar"

Case xlLine, _
xlLineStacked, _
xlLineStacked100, _
xlLineMarkers, _
xlLineMarkersStacked, _
xlLineMarkersStacked100, _
xl3DLine : ChartType_ReturnCategory = "Line"

Case xlBarOfPie, _
xlPie, _
xlPieExploded, _
xlPieOfPie, _
xl3DPie, _
xl3DPieExploded : ChartType_ReturnCategory = "Pie"

Case xlXYScatter, _
xlXYScatterLines, _
xlXYScatterLinesNoMarkers, _
xlXYScatterSmooth, _
xlXYScatterSmoothNoMarkers : ChartType_ReturnCategory = "Scatter"

Case xlArea, _
xlAreaStacked, _
xlAreaStacked100, _
xl3DArea, _
xl3DAreaStacked, _
xl3DAreaStacked100 : ChartType_ReturnCategory = "Area"

Case xlDoughnut, _
xlDoughnutExploded : ChartType_ReturnCategory = "Doughnut"

Case xlRadar, _
xlRadarMarkers, _
xlRadarFilled : ChartType_ReturnCategory = "Radar"

Case xlSurface, _
xlSurfaceTopView, _
xlSurfaceTopViewWireframe, _
xlSurfaceWireframe : ChartType_ReturnCategory = "Surface"

Case xlBubble, _
xlBubble3DEffect : ChartType_ReturnCategory = "Bubble"

Case xlStockHLC, _
xlStockVHLC, _
xlStockOHLC, _
xlStockVOHLC : ChartType_ReturnCategory = "Stock"

Case xlCylinderBarClustered, _
xlCylinderBarStacked, _
xlCylinderBarStacked100, _
xlCylinderColClustered, _
xlCylinderColStacked, _
xlCylinderColStacked100 : ChartType_ReturnCategory = "Cylinder"

Case xlConeBarClustered, _
xlConeBarStacked, _
xlConeBarStacked100, _
xlConeColClustered, _
xlConeColStacked, _
xlConeColStacked100 : ChartType_ReturnCategory = "Cone"

Case xlPyramidCol, _
xlPyramidBarClustered, _
xlPyramidBarStacked, _
xlPyramidBarStacked100, _
xlPyramidColClustered, _
xlPyramidColStacked, _
xlPyramidColStacked100 : ChartType_ReturnCategory = "Pyramid"


Case Else
Call MsgBox("Incorrect Chart Type number : " & _
objSeries.ChartType.ToString, , _
"Chart_TypeReturn")
End Select


Catch objCOMException As System.Runtime.InteropServices.COMException
mobjCOMException = objCOMException
Catch objException As Exception
mobjException = objException

Finally
If gbDEBUG = True Or _
((IsNothing(mobjCOMException) = False Or IsNothing(mobjException) = False)) Then

Call clsError.Handle("Chart_TypeReturn", msMODULENAME, _
"return the category name for the series '" & objSeries.Name & "'.", _
mobjCOMException, mobjException)
End If

End Try
End Function

ChartSeries_Valid

public static bool ChartSeriesValid(Excel.SeriesCollection objSeriesColl, int iSeriesNo)
{
try
{
// an error occurs when the series number is valid but not plotted - eg Pie Charts
Excel.Series objSeries;

objSeries = objSeriesColl.Item(iSeriesNo);

ChartSeriesValid = true;
}
catch (Runtime.InteropServices.COMException objCOMException)
{
ChartSeriesValid = false;
}
}
Public Shared Function ChartSeriesValid(ByVal objSeriesColl As Excel.SeriesCollection, _
ByVal iSeriesNo As Integer) As Boolean
Try
'an error occurs when the series number is valid but not plotted - eg Pie Charts
Dim objSeries As Excel.Series

objSeries = objSeriesColl.Item(iSeriesNo)

ChartSeriesValid = True

Catch objCOMException As System.Runtime.InteropServices.COMException

ChartSeriesValid = False
End Try
End Function

ChartSource_DataPlotByGet

public string ChartSource_DataPlotByGet(Excel.Chart objChart)
{
Excel.SeriesCollection objSeriesCol;
Excel.Series objSeries;

try
{
if (clsError.ErrorFlag() == true)
return;

objSeriesCol = (Excel.SeriesCollection)objChart.SeriesCollection;

if (objSeriesCol.Count > 0)
{
objSeries = objSeriesCol.Item(1);

MsgBox("Series Values: " + ChartSeries_FormulaValuesGet(objSeries) + Constants.vbCrLf + "Series Labels: " + ChartSeries_FormulaLabelsGet(objSeries));
}
}
catch (Runtime.InteropServices.COMException objCOMException)
{
gobjCOMException = objCOMException;
}
catch (Exception objException)
{
gobjException = objException;
}

finally
{
objChart = null/* TODO Change to default(_) if this is not a reference type */;
objSeriesCol = null/* TODO Change to default(_) if this is not a reference type */;
objSeries = null/* TODO Change to default(_) if this is not a reference type */;

if (gbDEBUG == true | ((IsNothing(gobjCOMException) == false | IsNothing(gobjException) == false)))
clsError.Handle("ChartSeries_SourceDataPlotByGet", msMODULENAME, "", gobjCOMException, gobjException);
}
}
Public Function ChartSource_DataPlotByGet(ByVal objChart As Excel.Chart) As String

Dim objSeriesCol As Excel.SeriesCollection
Dim objSeries As Excel.Series

Try
If clsError.ErrorFlag() = True Then Exit Function

objSeriesCol = CType(objChart.SeriesCollection, Excel.SeriesCollection)

If objSeriesCol.Count > 0 Then
objSeries = objSeriesCol.Item(1)

Call MsgBox("Series Values: " & ChartSeries_FormulaValuesGet(objSeries) & _
vbCrLf & _
"Series Labels: " & ChartSeries_FormulaLabelsGet(objSeries))

'Call MsgBox("Formula " & objSeries.Formula & vbCrLf & _
' "Formula Local " & objSeries.FormulaLocal & vbCrLf & _
' "Formula R1C1 " & objSeries.FormulaR1C1 & vbCrLf & _
' "Formula R1C1 Local " & objSeries.FormulaR1C1Local)

End If

Catch objCOMException As System.Runtime.InteropServices.COMException
gobjCOMException = objCOMException
Catch objException As Exception
gobjException = objException

Finally
objChart = Nothing
objSeriesCol = Nothing
objSeries = Nothing

If gbDEBUG = True Or _
((IsNothing(gobjCOMException) = False Or IsNothing(gobjException) = False)) Then

Call clsError.Handle("ChartSeries_SourceDataPlotByGet", msMODULENAME, _
"", _
gobjCOMException, gobjException)
End If
End Try

End Function

Message_NoChartIsSelected

public static void ChartNoChartSelectedInformation()
{
System.Windows.Forms.MessageBox.Show("No chart is currently selected.", gsDIALOG_PREFIX_EXCEL, Windows.Forms.MessageBoxButtons.OK, Windows.Forms.MessageBoxIcon.Information);
}
Public Shared Sub ChartNoChartSelectedInformation()

Call System.Windows.Forms.MessageBox.Show( _
"No chart is currently selected.", _
gsDIALOG_PREFIX_EXCEL, _
Windows.Forms.MessageBoxButtons.OK, _
Windows.Forms.MessageBoxIcon.Information)

End Sub

© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited Top