Skip to content

Commit d5b1ec1

Browse files
committed
Fix workbook names vs. paths
1 parent 6f78232 commit d5b1ec1

File tree

4 files changed

+20
-17
lines changed

4 files changed

+20
-17
lines changed

Source/ExcelDna.IntelliSense/ExcelDna.IntelliSense.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
<DefineConstants>DEBUG;TRACE</DefineConstants>
2323
<ErrorReport>prompt</ErrorReport>
2424
<WarningLevel>4</WarningLevel>
25+
<DocumentationFile>
26+
</DocumentationFile>
2527
</PropertyGroup>
2628
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
2729
<DebugType>pdbonly</DebugType>

Source/ExcelDna.IntelliSense/Providers/WorkbookIntelliSenseProvider.cs

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,13 @@ public void Initialize()
137137
{
138138
foreach (Workbook wb in xlApp.Workbooks)
139139
{
140-
var path = wb.FullName;
141-
if (!_workbookRegistrationInfos.ContainsKey(path))
140+
var name = wb.Name;
141+
if (!_workbookRegistrationInfos.ContainsKey(name))
142142
{
143-
WorkbookRegistrationInfo regInfo = new WorkbookRegistrationInfo(path);
144-
_workbookRegistrationInfos[path] = regInfo;
143+
WorkbookRegistrationInfo regInfo = new WorkbookRegistrationInfo(name);
144+
_workbookRegistrationInfos[name] = regInfo;
145145

146-
RegisterWithXmlProvider(wb, path);
146+
RegisterWithXmlProvider(wb);
147147

148148
regInfo.Refresh();
149149
}
@@ -175,32 +175,32 @@ public IList<FunctionInfo> GetFunctionInfos()
175175

176176
#endregion
177177

178-
void Excel_WorkbookOpen(Workbook Wb)
178+
void Excel_WorkbookOpen(Workbook wb)
179179
{
180-
var path = Wb.FullName;
181-
var regInfo = new WorkbookRegistrationInfo(path);
180+
var name = wb.Name;
181+
var regInfo = new WorkbookRegistrationInfo(name);
182182
lock (_workbookRegistrationInfos)
183183
{
184-
_workbookRegistrationInfos[path] = regInfo;
185-
RegisterWithXmlProvider(Wb, path);
184+
_workbookRegistrationInfos[name] = regInfo;
185+
RegisterWithXmlProvider(wb);
186186
OnInvalidate();
187187
}
188188
}
189189

190-
void Excel_WorkbookBeforeClose(Workbook Wb, ref bool Cancel)
190+
void Excel_WorkbookBeforeClose(Workbook wb, ref bool cancel)
191191
{
192192
// Do we have to worry about renaming / Save As?
193193
// Do we have to worry about other BeforeClose handlers cancelling the close?
194194
lock (_workbookRegistrationInfos)
195195
{
196-
var path = Wb.FullName;
197-
_workbookRegistrationInfos.Remove(path);
198-
UnregisterWithXmlProvider(Wb, path);
196+
_workbookRegistrationInfos.Remove(wb.Name);
197+
UnregisterWithXmlProvider(wb);
199198
}
200199
}
201200

202-
void RegisterWithXmlProvider(Workbook wb, string path)
201+
void RegisterWithXmlProvider(Workbook wb)
203202
{
203+
var path = wb.FullName;
204204
var xmlPath = GetXmlPath(path);
205205
_xmlProvider.RegisterXmlFunctionInfo(xmlPath); // Will check if file exists
206206

@@ -212,8 +212,9 @@ void RegisterWithXmlProvider(Workbook wb, string path)
212212
}
213213
}
214214

215-
void UnregisterWithXmlProvider(Workbook wb, string path)
215+
void UnregisterWithXmlProvider(Workbook wb)
216216
{
217+
var path = wb.FullName;
217218
var xmlPath = GetXmlPath(path);
218219
_xmlProvider.UnregisterXmlFunctionInfo(xmlPath);
219220
_xmlProvider.UnregisterXmlFunctionInfo(path);

Source/ExcelDna.IntelliSense/Providers/XmlIntelliSenseProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
namespace ExcelDna.IntelliSense
1111
{
12+
// CONSIDER: Support regular .NET XML documentation, either as files or packed?
1213
class XmlIntelliSenseProvider : IIntelliSenseProvider
1314
{
1415
public class XmlRegistrationInfo
@@ -184,7 +185,6 @@ void OnInvalidate(object _unused_)
184185

185186
public void Dispose()
186187
{
187-
throw new NotImplementedException();
188188
}
189189
}
190190

VBASamples/VBAFunctions.xlsm

121 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)