Commit 24dedb12 authored by lijingang's avatar lijingang

Initial commit

parents
Pipeline #285 failed with stages
This diff is collapsed.
This diff is collapsed.
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<StartAction>Program</StartAction>
<StartArguments>"C:\Users\Administrator\Desktop\Excel附注模版.xlsx"</StartArguments>
<StartProgram>C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE</StartProgram>
</PropertyGroup>
</Project>
\ No newline at end of file

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.14.36221.1 d17.14
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ExcelAddInDg", "ExcelAddInDg.csproj", "{8522A81B-9EC2-469D-BA74-17A5974E6D0F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{8522A81B-9EC2-469D-BA74-17A5974E6D0F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{8522A81B-9EC2-469D-BA74-17A5974E6D0F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{8522A81B-9EC2-469D-BA74-17A5974E6D0F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{8522A81B-9EC2-469D-BA74-17A5974E6D0F}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {E33CBB15-5516-49DF-8C71-03DABC8FEB62}
EndGlobalSection
EndGlobal
This diff is collapsed.
using System;
using System.Diagnostics;
using System.Collections.Generic;
using Excel = Microsoft.Office.Interop.Excel;
using NLog;
namespace ExcelAddInDg
{
/// <summary>
/// 负责订阅与取消订阅 Excel 应用级别的事件(如打开工作簿、工作簿关闭前等)。
/// 在 ThisAddIn.Startup 中创建并调用 Subscribe,在 Shutdown 中调用 Unsubscribe 或 Dispose。
/// </summary>
internal partial class ExcelEventSubscriptions : IDisposable
{
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
private readonly Excel.Application _excelApp;
private readonly Excel.AppEvents_Event _appEvents;
private bool _disposed = false;
// 保持对 delegate 的引用以防止被 GC 回收(这是 COM 事件的常见坑)
private Excel.AppEvents_WorkbookOpenEventHandler _workbookOpenHandler;
private Excel.AppEvents_WorkbookActivateEventHandler _workbookActivateHandler;
// 新增:保持对 Application.SheetActivate 处理器引用,防止 GC 回收
private Excel.AppEvents_SheetActivateEventHandler _sheetActivateHandler;
// 新增:保持对 WindowActivate 处理器引用,防止 GC 回收
private Excel.AppEvents_WindowActivateEventHandler _windowActivateHandler;
// 新增:用于指定只在某些工作簿上生效(若为空则对所有工作簿生效)
private readonly HashSet<string> _watchedWorkbookNames = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
private bool _isSubscribed;
public ExcelEventSubscriptions(Excel.Application excelApplication)
{
_excelApp = excelApplication ?? throw new ArgumentNullException(nameof(excelApplication));
_appEvents = _excelApp as Excel.AppEvents_Event;
Logger.Debug("ExcelEventSubscriptions 实例已创建。");
}
/// <summary>
/// 订阅需要的事件
/// </summary>
public void Subscribe()
{
if (_isSubscribed)
{
Logger.Debug("Subscribe 调用被忽略:已订阅。");
return;
}
if (_appEvents == null)
{
Logger.Warn("无法转换为 AppEvents_Event,事件订阅失败。");
return;
}
_workbookOpenHandler = new Excel.AppEvents_WorkbookOpenEventHandler(OnWorkbookOpen);
_appEvents.WorkbookOpen += _workbookOpenHandler;
// 订阅 Application 层的 SheetActivate,使切换工作表时触发(对所有工作簿,OnSheetActivated 内可筛选)
_sheetActivateHandler = new Excel.AppEvents_SheetActivateEventHandler(OnSheetActivated);
_appEvents.SheetActivate += _sheetActivateHandler;
// 订阅 WindowActivate(窗口激活时触发)
_windowActivateHandler = new Excel.AppEvents_WindowActivateEventHandler(Application_WindowActivate);
_appEvents.WindowActivate += _windowActivateHandler;
// 订阅 WorkbookActivate(在切换工作簿时触发)
_workbookActivateHandler = new Excel.AppEvents_WorkbookActivateEventHandler(OnWorkbookActivate);
_appEvents.WorkbookActivate += _workbookActivateHandler;
_isSubscribed = true;
Logger.Info("已订阅 Excel 应用级别事件(含 SheetActivate、WindowActivate)。");
}
/// <summary>
/// 取消订阅(并清理对 delegate 的引用)
/// </summary>
public void Unsubscribe()
{
if (!_isSubscribed)
{
Logger.Debug("Unsubscribe 调用被忽略:未处于订阅状态。");
return;
}
if (_appEvents != null)
{
if (_workbookOpenHandler != null) _appEvents.WorkbookOpen -= _workbookOpenHandler;
if (_workbookActivateHandler != null) _appEvents.WorkbookActivate -= _workbookActivateHandler;
if (_sheetActivateHandler != null) _appEvents.SheetActivate -= _sheetActivateHandler;
if (_windowActivateHandler != null) _appEvents.WindowActivate -= _windowActivateHandler;
}
_workbookOpenHandler = null;
_workbookActivateHandler = null;
_sheetActivateHandler = null;
_windowActivateHandler = null;
_isSubscribed = false;
Logger.Info("已取消订阅 Excel 应用级别事件。");
}
// 终结器:最后的保障
~ExcelEventSubscriptions()
{
Dispose(false);
}
protected virtual void Dispose(bool disposing)
{
if (_disposed) return;
if (disposing)
{
// 安全地释放托管资源
Unsubscribe(); // 取消事件订阅
}
// 这里可以释放非托管资源(如果有的话)
_disposed = true;
}
public void Dispose()
{
//Dispose(true);
GC.SuppressFinalize(this);
Logger.Debug("ExcelEventSubscriptions 已 Dispose。");
}
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true"
throwConfigExceptions="true">
<!-- 指定日志文件的存储位置 - 选择其中一种配置 -->
<!-- 选项1: 当前用户的MyDocuments文件夹下的Cpas6.0Addin/Logs目录(默认配置) -->
<!-- <variable name="logDirectory" value="${specialfolder:folder=MyDocuments}/Cpas6.0Addin/Logs" /> -->
<!-- 选项2: 程序运行目录下的Logs文件夹 -->
<variable name="logDirectory" value="${basedir}/../logs/vsto" />
<!-- 选项3: Windows临时文件夹下的Cpas6Logs目录 -->
<!-- <variable name="logDirectory" value="${specialfolder:folder=LocalApplicationData}/Cpas6Logs" /> -->
<!-- 选项4: 自定义绝对路径 (请根据实际需要修改路径) -->
<!-- <variable name="logDirectory" value="C:/MyApp/Logs" /> -->
<!-- 选项5: 系统公共文档目录下的Cpas6Logs文件夹 -->
<!-- <variable name="logDirectory" value="${specialfolder:folder=CommonDocuments}/Cpas6Logs" /> -->
<targets>
<!-- 输出日志到文件 -->
<target xsi:type="File"
name="file"
fileName="${logDirectory}/${shortdate}.log"
layout="${longdate} ${uppercase:${level}} ${message} ${exception:format=tostring}"
archiveFileName="${logDirectory}/archive/log.{####}.txt"
archiveEvery="Day"
archiveNumbering="Rolling"
maxArchiveFiles="10"
concurrentWrites="true"
keepFileOpen="false"
encoding="utf-8" />
<!-- 输出日志到 Visual Studio 调试窗口 -->
<target xsi:type="Debugger"
name="debug"
layout="${longdate} ${uppercase:${level}} ${message}" />
</targets>
<rules>
<!-- 记录所有级别的日志到文件 -->
<logger name="*" minlevel="Trace" writeTo="file" />
<!-- 仅在调试模式下记录日志到调试窗口 -->
<logger name="*" minlevel="Trace" writeTo="debug" final="true" enabled="true" />
</rules>
</nlog>
\ No newline at end of file
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
// 有关程序集的一般信息由以下
// 控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("ExcelAddInDg")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ExcelAddInDg")]
[assembly: AssemblyCopyright("Copyright © 2025")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//将 ComVisible 设置为 false 将使此程序集中的类型
//对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
//请将此类型的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("b8956e17-72de-40f9-b7af-bbb34d58f9ba")]
// 程序集的版本信息由下列四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”: :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ExcelAddInDg.Properties {
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ExcelAddInDg.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace ExcelAddInDg.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
This diff is collapsed.
<hostitem:hostItem hostitem:baseType="Microsoft.Office.Tools.AddInBase" hostitem:namespace="ExcelAddInDg" hostitem:className="ThisAddIn" hostitem:identifier="ThisAddIn" hostitem:primaryCookie="AddIn" hostitem:master="true" hostitem:factoryType="Microsoft.Office.Tools.Excel.ApplicationFactory" hostitem:startupIndex="0" xmlns:hostitem="http://schemas.microsoft.com/2004/VisualStudio/Tools/Applications/HostItem.xsd">
<hostitem:hostObject hostitem:name="Application" hostitem:identifier="Application" hostitem:type="Microsoft.Office.Interop.Excel.Application" hostitem:cookie="Application" hostitem:modifier="Internal" />
<hostitem:hostControl hostitem:name="CustomTaskPanes" hostitem:identifier="CustomTaskPanes" hostitem:type="Microsoft.Office.Tools.CustomTaskPaneCollection" hostitem:primaryCookie="CustomTaskPanes" hostitem:modifier="Internal" />
<hostitem:hostControl hostitem:name="VstoSmartTags" hostitem:identifier="VstoSmartTags" hostitem:type="Microsoft.Office.Tools.SmartTagCollection" hostitem:primaryCookie="VstoSmartTags" hostitem:modifier="Internal" />
</hostitem:hostItem>
\ No newline at end of file
using Microsoft.Office.Tools.Excel;
using NLog;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using Excel = Microsoft.Office.Interop.Excel;
using Office = Microsoft.Office.Core;
namespace ExcelAddInDg
{
public partial class ThisAddIn
{
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
// 管理 Excel 事件订阅的实例
private ExcelEventSubscriptions _excelEvents;
private readonly object _lockObject = new object();
private bool _isInitialized = false;
private void ThisAddIn_Startup(object sender, System.EventArgs e)
{
Logger.Info("Add-in 启动 - ThisAddIn_Startup 开始。");
lock (_lockObject)
{
if (_isInitialized) return; // 防止重复初始化
try
{
_excelEvents = new ExcelEventSubscriptions(this.Application);
_excelEvents.Subscribe();
_isInitialized = true;
Logger.Info("Excel Add-in 启动完成");
}
catch (Exception ex)
{
Logger.Info($"Add-in 启动失败: {ex}");
// 清理部分初始化的状态
_excelEvents?.Dispose();
_excelEvents = null;
}
}
}
private void ThisAddIn_Shutdown(object sender, System.EventArgs e)
{
Logger.Info("Add-in 关闭 - ThisAddIn_Shutdown 开始。");
lock (_lockObject)
{
try
{
if (_excelEvents != null)
{
_excelEvents.Dispose();
_excelEvents = null;
_isInitialized = false;
}
Logger.Info("Excel Add-in 关闭完成");
}
catch (Exception ex)
{
Logger.Info($"Add-in 关闭过程中发生异常: {ex}");
}
}
}
#region VSTO 生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要修改
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InternalStartup()
{
this.Startup += new System.EventHandler(ThisAddIn_Startup);
this.Shutdown += new System.EventHandler(ThisAddIn_Shutdown);
}
#endregion
}
}
This diff is collapsed.
<?xml version="1.0" encoding="utf-8"?>
<asmv1:assembly xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" manifestVersion="1.0" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns="urn:schemas-microsoft-com:asm.v2" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xrml="urn:mpeg:mpeg21:2003:01-REL-R-NS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" xmlns:co.v1="urn:schemas-microsoft-com:clickonce.v1" xmlns:co.v2="urn:schemas-microsoft-com:clickonce.v2">
<assemblyIdentity name="ExcelAddInDg.vsto" version="1.0.0.0" publicKeyToken="c95f25e5e8f049ef" language="neutral" processorArchitecture="msil" xmlns="urn:schemas-microsoft-com:asm.v1" />
<description asmv2:publisher="ExcelAddInDg" asmv2:product="ExcelAddInDg" xmlns="urn:schemas-microsoft-com:asm.v1" />
<deployment install="false" />
<compatibleFrameworks xmlns="urn:schemas-microsoft-com:clickonce.v2">
<framework targetVersion="4.7.2" profile="Full" supportedRuntime="4.0.30319" />
</compatibleFrameworks>
<dependency>
<dependentAssembly dependencyType="install" codebase="ExcelAddInDg.dll.manifest" size="15224">
<assemblyIdentity name="ExcelAddInDg.dll" version="1.0.0.0" publicKeyToken="c95f25e5e8f049ef" language="neutral" processorArchitecture="msil" type="win32" />
<hash>
<dsig:Transforms>
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
</dsig:Transforms>
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
<dsig:DigestValue>IaG4xQvtQJlxcsqCWNUdmkXWbYR/kGqVYCpkO1UjbIQ=</dsig:DigestValue>
</hash>
</dependentAssembly>
</dependency>
<publisherIdentity name="CN=LJG\Administrator" issuerKeyHash="969545d3b46882fa38a64eca7ca918f832f919bd" /><Signature Id="StrongNameSignature" xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha256" /><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /><Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" /><DigestValue>499WdZd89XIxEfbh++trYMBz13wBxs9zOCgQXtHt5Nc=</DigestValue></Reference></SignedInfo><SignatureValue>BNeoBqcktwlGgIsBPTjG32jn/5nUcJKS+hdhNBE43oIObkNL1GjncoQFLAatWImX17fF3kUEpyyoPBa1tfJu4d5AGqP8Gd+czLtT3dzmu5KOnXS07uI5qtACxcaLHHMoktwHsP0Z+UDwrglnSVfsUOcNsC1fKgSlPKtvsQTV68M=</SignatureValue><KeyInfo Id="StrongNameKeyInfo"><KeyValue><RSAKeyValue><Modulus>1AGZYZEYWDuHmU4Vm9OeccJ+bItBv/NlZ3LetBM7Ei/CbTpPkxaqfVHkqc7utAtRP/gc79esMCwdKqkKEW992YH9jVwPNvKlODJozJCVrbrOMiMO/cxddn5mRx2K3IwNGSHbqkGOQVnEvr+3T7OYj+88CWJ7ck5QAWqtsyunnCE=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue></KeyValue><msrel:RelData xmlns:msrel="http://schemas.microsoft.com/windows/rel/2005/reldata"><r:license xmlns:r="urn:mpeg:mpeg21:2003:01-REL-R-NS" xmlns:as="http://schemas.microsoft.com/windows/pki/2005/Authenticode"><r:grant><as:ManifestInformation Hash="d7e4edd15e10283873cfc6017cd773c0606bebfbe1f6113172f57c977556dfe3" Description="" Url=""><as:assemblyIdentity name="ExcelAddInDg.vsto" version="1.0.0.0" publicKeyToken="c95f25e5e8f049ef" language="neutral" processorArchitecture="msil" xmlns="urn:schemas-microsoft-com:asm.v1" /></as:ManifestInformation><as:SignedBy /><as:AuthenticodePublisher><as:X509SubjectName>CN=LJG\Administrator</as:X509SubjectName></as:AuthenticodePublisher></r:grant><r:issuer><Signature Id="AuthenticodeSignature" xmlns="http://www.w3.org/2000/09/xmldsig#"><SignedInfo><CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /><SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha256" /><Reference URI=""><Transforms><Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" /><Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" /></Transforms><DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" /><DigestValue>z2sBjfgeSd7elZ6mMVaEvdEkZHkB4BTe8tgciqSV1O4=</DigestValue></Reference></SignedInfo><SignatureValue>vr7/p5P6QWmPwBXyK5VVlzYiSNIrGEIkYyja4RLVBSjreIIm3liZhCmySGXciAGkk+rSMq6vkW85SPk/+RI3mSlSk3MRvsX8o+Dl8LwehHL7QBHLpydskUXiCUPOWE0KLjUUM+C8CyR9UMe2SC1EqOEYoYp+ggT5UpVxHg4gRz0=</SignatureValue><KeyInfo><KeyValue><RSAKeyValue><Modulus>1AGZYZEYWDuHmU4Vm9OeccJ+bItBv/NlZ3LetBM7Ei/CbTpPkxaqfVHkqc7utAtRP/gc79esMCwdKqkKEW992YH9jVwPNvKlODJozJCVrbrOMiMO/cxddn5mRx2K3IwNGSHbqkGOQVnEvr+3T7OYj+88CWJ7ck5QAWqtsyunnCE=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue></KeyValue><X509Data><X509Certificate>MIIB3TCCAUagAwIBAgIQHQ1DcQBoz4RAl/8DrisoDDANBgkqhkiG9w0BAQsFADAtMSswKQYDVQQDHiIATABKAEcAXABBAGQAbQBpAG4AaQBzAHQAcgBhAHQAbwByMB4XDTI1MTEyNzAyMzM0NFoXDTI2MTEyNzA4MzM0NFowLTErMCkGA1UEAx4iAEwASgBHAFwAQQBkAG0AaQBuAGkAcwB0AHIAYQB0AG8AcjCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA1AGZYZEYWDuHmU4Vm9OeccJ+bItBv/NlZ3LetBM7Ei/CbTpPkxaqfVHkqc7utAtRP/gc79esMCwdKqkKEW992YH9jVwPNvKlODJozJCVrbrOMiMO/cxddn5mRx2K3IwNGSHbqkGOQVnEvr+3T7OYj+88CWJ7ck5QAWqtsyunnCECAwEAATANBgkqhkiG9w0BAQsFAAOBgQB4wf2tiJxXUwoU8XPKh/Eh/ulJycZLm/2GV9iHvI53C4Eo6q9uUJ17knyLYa/6Q6O+x9A1k5u99Rvdm5K7Q7XkEVYs2gV0739DLgQ9U+9N7edQfhQ5ZAcCHZyF/kz5jGkw0h8YwKNhaczoWqdkL+NbPPEATyHsfYelh2Pk0z1MQg==</X509Certificate></X509Data></KeyInfo></Signature></r:issuer></r:license></msrel:RelData></KeyInfo></Signature></asmv1:assembly>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
a3f7076c38f50da6ae6311a4d22de0b09f856c94e6e3bad8dadb1890c593a755
C:\Users\Administrator\Desktop\youdatasumCode\ExcelAddInDg\bin\Debug\ExcelAddInDg.dll
C:\Users\Administrator\Desktop\youdatasumCode\ExcelAddInDg\bin\Debug\ExcelAddInDg.pdb
C:\Users\Administrator\Desktop\youdatasumCode\ExcelAddInDg\bin\Debug\ExcelAddInDg.dll.manifest
C:\Users\Administrator\Desktop\youdatasumCode\ExcelAddInDg\bin\Debug\ExcelAddInDg.vsto
C:\Users\Administrator\Desktop\youdatasumCode\ExcelAddInDg\bin\Debug\Microsoft.Office.Tools.Common.v4.0.Utilities.dll
C:\Users\Administrator\Desktop\youdatasumCode\ExcelAddInDg\obj\Debug\ExcelAddInDg.csproj.AssemblyReference.cache
C:\Users\Administrator\Desktop\youdatasumCode\ExcelAddInDg\obj\Debug\ExcelAddInDg.Properties.Resources.resources
C:\Users\Administrator\Desktop\youdatasumCode\ExcelAddInDg\obj\Debug\ExcelAddInDg.csproj.GenerateResource.cache
C:\Users\Administrator\Desktop\youdatasumCode\ExcelAddInDg\obj\Debug\ExcelAddInDg.csproj.CoreCompileInputs.cache
C:\Users\Administrator\Desktop\youdatasumCode\ExcelAddInDg\obj\Debug\ExcelAdd.0E17C6B6.Up2Date
C:\Users\Administrator\Desktop\youdatasumCode\ExcelAddInDg\obj\Debug\ExcelAddInDg.dll
C:\Users\Administrator\Desktop\youdatasumCode\ExcelAddInDg\obj\Debug\ExcelAddInDg.pdb
C:\Users\Administrator\Desktop\youdatasumCode\ExcelAddInDg\bin\Debug\NLog.dll
C:\Users\Administrator\Desktop\youdatasumCode\ExcelAddInDg\bin\Debug\NLog.xml
C:\Users\Administrator\Desktop\youdatasumCode\ExcelAddInDg\bin\Debug\Newtonsoft.Json.dll
C:\Users\Administrator\Desktop\youdatasumCode\ExcelAddInDg\bin\Debug\Newtonsoft.Json.xml
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="13.0.4" targetFramework="net472" />
<package id="NLog" version="6.0.6" targetFramework="net472" />
</packages>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
The MIT License (MIT)
Copyright (c) 2007 James Newton-King
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
# ![Logo](https://raw.githubusercontent.com/JamesNK/Newtonsoft.Json/master/Doc/icons/logo.jpg) Json.NET
[![NuGet version (Newtonsoft.Json)](https://img.shields.io/nuget/v/Newtonsoft.Json.svg?style=flat-square)](https://www.nuget.org/packages/Newtonsoft.Json/)
[![Build status](https://dev.azure.com/jamesnk/Public/_apis/build/status/JamesNK.Newtonsoft.Json?branchName=master)](https://dev.azure.com/jamesnk/Public/_build/latest?definitionId=8)
Json.NET is a popular high-performance JSON framework for .NET
## Serialize JSON
```csharp
Product product = new Product();
product.Name = "Apple";
product.Expiry = new DateTime(2008, 12, 28);
product.Sizes = new string[] { "Small" };
string json = JsonConvert.SerializeObject(product);
// {
// "Name": "Apple",
// "Expiry": "2008-12-28T00:00:00",
// "Sizes": [
// "Small"
// ]
// }
```
## Deserialize JSON
```csharp
string json = @"{
'Name': 'Bad Boys',
'ReleaseDate': '1995-4-7T00:00:00',
'Genres': [
'Action',
'Comedy'
]
}";
Movie m = JsonConvert.DeserializeObject<Movie>(json);
string name = m.Name;
// Bad Boys
```
## LINQ to JSON
```csharp
JArray array = new JArray();
array.Add("Manual text");
array.Add(new DateTime(2000, 5, 23));
JObject o = new JObject();
o["MyArray"] = array;
string json = o.ToString();
// {
// "MyArray": [
// "Manual text",
// "2000-05-23T00:00:00"
// ]
// }
```
## Links
- [Homepage](https://www.newtonsoft.com/json)
- [Documentation](https://www.newtonsoft.com/json/help)
- [NuGet Package](https://www.nuget.org/packages/Newtonsoft.Json)
- [Release Notes](https://github.com/JamesNK/Newtonsoft.Json/releases)
- [Contributing Guidelines](https://github.com/JamesNK/Newtonsoft.Json/blob/master/CONTRIBUTING.md)
- [License](https://github.com/JamesNK/Newtonsoft.Json/blob/master/LICENSE.md)
- [Stack Overflow](https://stackoverflow.com/questions/tagged/json.net)
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment