internal static WorkbookPublishSettings GetSettingsForSavedWorkbook(string workbookWithPath)
{
//Sanity test: If the workbook is not there, then we probably have an incorrect path
AppDiagnostics.Assert(File.Exists(workbookWithPath), "Underlying workbook does not exist");
//Find the path to the settings file
var pathToSettingsFile = PathForSettingsFile(workbookWithPath);
if(!File.Exists(pathToSettingsFile))
{
return GenerateDefaultSettings();
}
//===================================================================
//We've got a setings file, let's parse it!
//===================================================================
var xmlDoc = new XmlDocument();
xmlDoc.Load(pathToSettingsFile);
//Show sheets
bool showSheetsInTabs = ParseXml_GetShowSheetsAsTabs(xmlDoc);
string ownerName = ParseXml_GetOwnerName(xmlDoc);
//Return the Settings data
return new WorkbookPublishSettings(showSheetsInTabs, ownerName);
}