C# Class UnicodeCSVAddin.ThisAddIn

显示文件 Open project: jaimonmathew/Unicode-CSV-Addin

Public Methods

Method Description
SaveAsUnicodeCSV ( bool force, bool newFile ) : void

This will create a temporary file in Unicode text (*.txt) format, overwrite the current loaded file by replaing all tabs with a comma and reload the file.

Protected Methods

Method Description
CreateRibbonExtensibilityObject ( ) : Microsoft.Office.Core.IRibbonExtensibility

Private Methods

Method Description
InternalStartup ( ) : void

Required method for Designer support - do not modify the contents of this method with the code editor.

ThisAddIn_Shutdown ( object sender, EventArgs e ) : void
ThisAddIn_Startup ( object sender, System e ) : void
app_WorkbookBeforeClose ( Microsoft.Office.Interop.Excel Wb, bool &Cancel ) : void
app_WorkbookBeforeSave ( Microsoft.Office.Interop.Excel Wb, bool SaveAsUI, bool &Cancel ) : void
app_WorkbookOpen ( Microsoft.Office.Interop.Excel Wb ) : void
isFileUnicode ( string filename ) : bool

This method will try and read the first few bytes to see if it contains a Unicode BOM

isInCellEditingMode ( ) : bool

This method check whether Excel is in Cell Editing mode or not There are few ways to check this (eg. check to see if a standard menu item is disabled etc.) I know in cell editing mode app.DisplayAlerts throws an Exception, so here I'm relying on that behaviour

Method Details

CreateRibbonExtensibilityObject() protected method

protected CreateRibbonExtensibilityObject ( ) : Microsoft.Office.Core.IRibbonExtensibility
return Microsoft.Office.Core.IRibbonExtensibility

SaveAsUnicodeCSV() public method

This will create a temporary file in Unicode text (*.txt) format, overwrite the current loaded file by replaing all tabs with a comma and reload the file.
public SaveAsUnicodeCSV ( bool force, bool newFile ) : void
force bool To force save the current file as a Unicode CSV. /// When called from the Ribbon items Save/SaveAs, force will be true /// If this parameter is true and the file name extention is not .csv, then a SaveAs dialog will be displayed to choose a .csv file
newFile bool To show a SaveAs dialog box to select a new file name /// This will be set to true when called from the Ribbon item SaveAs
return void