コード例 #1
0
        /// <summary>
        /// Returns the file path derived from the <see cref="ExcelVbaReference"/> Libid.
        /// </summary>
        /// <param name="reference"><see cref="ExcelVbaReference"/> to extract file path from.</param>
        /// <returns></returns>
        public string GetReferencePath(ExcelVbaReference reference)
        {
            var path = reference.Libid.Substring(3);

            _logger.Log($"Found reference path \"{path}\"");
            return(path);
        }
コード例 #2
0
 /// <summary>
 /// Removes the dependency of the referenced file from the <paramref name="targetProject"/>.
 /// </summary>
 /// <param name="targetProject"><see cref="ExcelVbaProject"/> to remove reference from.</param>
 /// <param name="reference"><see cref="ExcelVbaReference"/> to remove.</param>
 /// <returns></returns>
 public bool TryRemoveReference(ref ExcelVbaProject targetProject, ExcelVbaReference reference)
 {
     try
     {
         _logger.Log($"Removing reference \"{reference.Name}\" from \"{targetProject.Name}\"");
         targetProject.References.Remove(reference);
         return(true);
     }
     catch (Exception ex)
     {
         throw;
     }
 }