C#으로 작성된 콘솔 응용 프로그램에서 아래와 같은 간단한 할당 :는 "값이 예상 범위를 벗어"
:workbook.CustomDocumentProperties.Item["PropertyName"] = "Property Value";
다음과 같은 오류를 생성합니다
workbook.CustomDocumentProperties.Add("PropertyName", "Property Value");
:
{"Value does not fall within the expected range."}
Data: {System.Collections.ListDictionaryInternal}
HResult: -2147024809
HelpLink: null
IPForWatsonBuckets: 0x633f1015
InnerException: null
IsTransient: false
Message: "Value does not fall within the expected range."
ParamName: null
RemoteStackTrace: null
Source: "System.Dynamic"
StackTrace: " at System.Dynamic.ComRuntimeHelpers.CheckThrowException(Int32 hresult, ExcepInfo& excepInfo, UInt32 argErr, String message)\r\n at CallSite.Target(Closure , CallSite , Object , String , Object)\r\n at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2)\r\n at CustomDocumentProperties.Program.WriteToExcelCustomDocumentProperties(String excelFile, String outputFolder, String propertyName, Object propertyValue) in C:\\Sathyaish\\DotNet\\CustomDocumentProperties\\CustomDocumentProperties\\Program.cs:line 100"
TargetSite: {Void CheckThrowException(Int32, System.Dynamic.ExcepInfo ByRef, UInt32, System.String)}
WatsonBuckets: null
_HResult: -2147024809
_className: null
_data: {System.Collections.ListDictionaryInternal}
_dynamicMethods: {object[2]}
_exceptionMethod: {Void CheckThrowException(Int32, System.Dynamic.ExcepInfo ByRef, UInt32, System.String)}
_exceptionMethodString: null
_helpURL: null
_innerException: null
_ipForWatsonBuckets: 0x633f1015
_message: "Value does not fall within the expected range."
_remoteStackIndex: 0
_remoteStackTraceString: null
_safeSerializationManager: {System.Runtime.Serialization.SafeSerializationManager}
_source: "System.Dynamic"
_stackTrace: {sbyte[96]}
_stackTraceString: null
_watsonBuckets: null
_xcode: -532462766
_xptrs: 0x00000000
m_paramName: null
은 내가 먼저 그렇게 같은 CustomDocumentProperties
특성에 Add
메소드를 호출 시도 그 실패
, 내가 (강조 광산)은 다음과 같이 발언하는 the documentation을 검토 : 속성이 존재하지 않는 경우
This property returns the entire collection of custom document properties. Use the Microsoft.Office.Core.DocumentProperties.Item(System.Object) property to return a single member of the collection (a Microsoft.Office.Core.DocumentProperties object) by specifying either the name of the property or the collection index (as a number).
실제로 말 그대로 "PropertyName"을 속성 이름으로 사용 했습니까? – oerkelens
아니오 및 예. 위의 코드는 자리 표시 자입니다. 실제 값으로 시도했지만 제대로 작동하지 않을 때 속성 이름으로''PropertyName "'을 사용했습니다. 왜? –