Class UtilityExtensions
Defines a set of utility extension methods.
Inheritance
Inherited Members
Namespace: Quark.CMSAdapters.Core.Office.Utilities
Assembly: Quark.CMSAdapters.Core.Office.dll
Syntax
public static class UtilityExtensions
Methods
AddCustomDocumentAttribute(IDocument, String, Boolean, Object)
Adds the custom document attribute.
Declaration
public static void AddCustomDocumentAttribute(this IDocument document, string attributeName, bool reset = false, object value = null)
Parameters
Type | Name | Description |
---|---|---|
IDocument | document | The document. |
System.String | attributeName | Name of the attribute. |
System.Boolean | reset | if set to |
System.Object | value | The value. |
Exceptions
Type | Condition |
---|---|
System.Exception |
AddCustomXMLPart(CustomXMLParts, Object, String)
Adds the custom XML part.
Declaration
public static void AddCustomXMLPart(this CustomXMLParts xmlParts, object xmlPart, string xmlPartNamespace)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Office.Core.CustomXMLParts | xmlParts | The XML parts. |
System.Object | xmlPart | The XML part. |
System.String | xmlPartNamespace | The XML part namespace. |
AddDocumentInfo(CustomXMLParts, DocumentInfo)
Adds the document information.
Declaration
public static void AddDocumentInfo(this CustomXMLParts xmlParts, DocumentInfo documentInfo)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Office.Core.CustomXMLParts | xmlParts | The XML parts. |
DocumentInfo | documentInfo | The document information. |
AddProperty(DocumentProperties, String, String)
Adds the property.
Declaration
public static void AddProperty(this DocumentProperties customDocumentProperties, string name, string value)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Office.Core.DocumentProperties | customDocumentProperties | The custom document properties. |
System.String | name | The name. |
System.String | value | The value. |
Create(String)
Creates DocumentInfo object from the specified XML.
Declaration
public static DocumentInfo Create(this string xml)
Parameters
Type | Name | Description |
---|---|---|
System.String | xml | The XML. |
Returns
Type | Description |
---|---|
DocumentInfo |
CreateCustomXMLPart<T>(String, String)
Creates the custom XML part.
Declaration
public static T CreateCustomXMLPart<T>(this string xml, string xmlPartNamespace)
where T : class
Parameters
Type | Name | Description |
---|---|---|
System.String | xml | The XML. |
System.String | xmlPartNamespace | The XML part namespace. |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
DeleteCustomDocumentAttribute(IDocument, String)
Deletes the custom document attribute.
Declaration
public static bool DeleteCustomDocumentAttribute(this IDocument document, string attributeName)
Parameters
Type | Name | Description |
---|---|---|
IDocument | document | The document. |
System.String | attributeName | Name of the attribute. |
Returns
Type | Description |
---|---|
System.Boolean | true if success else false |
DeleteCustomXMLPart(CustomXMLParts, String)
Deletes the custom XML part.
Declaration
public static void DeleteCustomXMLPart(this CustomXMLParts xmlParts, string xmlPartNamespace)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Office.Core.CustomXMLParts | xmlParts | The XML parts. |
System.String | xmlPartNamespace | The XML part namespace. |
DeleteDocumentInfo(CustomXMLParts)
Deletes the document information.
Declaration
public static void DeleteDocumentInfo(this CustomXMLParts xmlParts)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Office.Core.CustomXMLParts | xmlParts | The XML parts. |
DeleteProperty(DocumentProperties, String)
Deletes the property.
Declaration
public static void DeleteProperty(this DocumentProperties customDocumentProperties, string name)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Office.Core.DocumentProperties | customDocumentProperties | The custom document properties. |
System.String | name | The name. |
DisableAutoSaveRevision(PreferenceService)
Disables the automatic save revision.
Declaration
public static bool? DisableAutoSaveRevision(this PreferenceService preferenceService)
Parameters
Type | Name | Description |
---|---|---|
PreferenceService | preferenceService | The preference service. |
Returns
Type | Description |
---|---|
System.Nullable<System.Boolean> |
EvaluateCustomXPath(IDocument, String)
Evaluates the custom xpath.
Declaration
public static List<string> EvaluateCustomXPath(this IDocument document, string customPath)
Parameters
Type | Name | Description |
---|---|---|
IDocument | document | The document. |
System.String | customPath | The custom path. |
Returns
Type | Description |
---|---|
System.Collections.Generic.List<System.String> |
FeedData(OpenXmlPart, DocumentInfo)
Feeds the data.
Declaration
public static void FeedData(this OpenXmlPart openXmlPart, DocumentInfo documentInfo)
Parameters
Type | Name | Description |
---|---|---|
DocumentFormat.OpenXml.Packaging.OpenXmlPart | openXmlPart | The open XML part. |
DocumentInfo | documentInfo | The document information. |
GetBoolValue(Dictionary<String, String>, String)
Gets the bool value.
Declaration
public static bool? GetBoolValue(this Dictionary<string, string> arguments, string key)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.Dictionary<System.String, System.String> | arguments | The arguments. |
System.String | key | The key. |
Returns
Type | Description |
---|---|
System.Nullable<System.Boolean> |
GetCustomDocumentAttribute(IDocument, String)
Gets the custom document attribute value.
Declaration
public static string GetCustomDocumentAttribute(this IDocument document, string attributeName)
Parameters
Type | Name | Description |
---|---|---|
IDocument | document | The document. |
System.String | attributeName | Name of the attribute. |
Returns
Type | Description |
---|---|
System.String |
GetCustomXMLPart(OpenXmlPart, String)
Gets the custom XML part.
Declaration
public static CustomXmlPart GetCustomXMLPart(this OpenXmlPart openXmlPart, string namespaceURI)
Parameters
Type | Name | Description |
---|---|---|
DocumentFormat.OpenXml.Packaging.OpenXmlPart | openXmlPart | The open XML part. |
System.String | namespaceURI | The namespace URI. |
Returns
Type | Description |
---|---|
DocumentFormat.OpenXml.Packaging.CustomXmlPart |
GetCustomXMLPart<T>(CustomXMLParts, String)
Gets the custom XML part.
Declaration
public static T GetCustomXMLPart<T>(this CustomXMLParts xmlParts, string xmlPartNamespace)
where T : class
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Office.Core.CustomXMLParts | xmlParts | The XML parts. |
System.String | xmlPartNamespace | The XML part namespace. |
Returns
Type | Description |
---|---|
T |
Type Parameters
Name | Description |
---|---|
T |
GetDocumentInfo(CustomXMLParts)
Gets the document information.
Declaration
public static DocumentInfo GetDocumentInfo(this CustomXMLParts xmlParts)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Office.Core.CustomXMLParts | xmlParts | The XML parts. |
Returns
Type | Description |
---|---|
DocumentInfo |
GetInitialFileName(IDocument)
Gets the initial name of the file.
Declaration
public static string GetInitialFileName(this IDocument document)
Parameters
Type | Name | Description |
---|---|---|
IDocument | document | The document. |
Returns
Type | Description |
---|---|
System.String |
GetProperty(DocumentProperties, String)
Gets the property.
Declaration
public static string GetProperty(this DocumentProperties customDocumentProperties, string name)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Office.Core.DocumentProperties | customDocumentProperties | The custom document properties. |
System.String | name | The name. |
Returns
Type | Description |
---|---|
System.String |
GetTextValue(Dictionary<String, String>, String)
Gets the text value.
Declaration
public static string GetTextValue(this Dictionary<string, string> arguments, string key)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.Dictionary<System.String, System.String> | arguments | The arguments. |
System.String | key | The key. |
Returns
Type | Description |
---|---|
System.String |
IsFile(String)
Determines whether string represents file uri.
Declaration
public static bool IsFile(this string uriString)
Parameters
Type | Name | Description |
---|---|---|
System.String | uriString | The URI string. |
Returns
Type | Description |
---|---|
System.Boolean |
|
ReadAttributeValues(IDocument, RelationTypeElement, Func<String, List<String>>)
Reads the attribute values.
Declaration
public static Dictionary<string, AttributeInfo> ReadAttributeValues(this IDocument document, RelationTypeElement relationTypeElement, Func<string, List<string>> xPathEvaluator = null)
Parameters
Type | Name | Description |
---|---|---|
IDocument | document | The document. |
RelationTypeElement | relationTypeElement | The relation type element. |
System.Func<System.String, System.Collections.Generic.List<System.String>> | xPathEvaluator | The xPath evaluator. |
Returns
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, AttributeInfo> |
ReadAttributeValues(IDocument, Dictionary<String, AttributeElement>, Func<String, List<String>>)
Reads the attribute values.
Declaration
public static Dictionary<string, AttributeInfo> ReadAttributeValues(this IDocument document, Dictionary<string, AttributeElement> attributeElements, Func<string, List<string>> xPathEvaluator = null)
Parameters
Type | Name | Description |
---|---|---|
IDocument | document | The document. |
System.Collections.Generic.Dictionary<System.String, AttributeElement> | attributeElements | The attribute elements. |
System.Func<System.String, System.Collections.Generic.List<System.String>> | xPathEvaluator | The xPath evaluator. |
Returns
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, AttributeInfo> |
ReadAttributeValues(IDocument, String, DocumentInfo)
Reads the custom document attribute.
Declaration
public static Dictionary<string, AttributeInfo> ReadAttributeValues(this IDocument document, string componentRoot = null, DocumentInfo documentInfo = null)
Parameters
Type | Name | Description |
---|---|---|
IDocument | document | The document. |
System.String | componentRoot | The component root. |
DocumentInfo | documentInfo | The document information. |
Returns
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, AttributeInfo> |
ReadAttributeValues(IDocument, String, String, String, Func<String, List<String>>)
Reads the component specific attribute values.
Declaration
public static Dictionary<string, AttributeInfo> ReadAttributeValues(this IDocument document, string componentRoot, string productLine, string urn, Func<string, List<string>> xPathEvaluator = null)
Parameters
Type | Name | Description |
---|---|---|
IDocument | document | The document. |
System.String | componentRoot | The component root. |
System.String | productLine | The product line. |
System.String | urn | The urn. |
System.Func<System.String, System.Collections.Generic.List<System.String>> | xPathEvaluator | The xPath evaluator. |
Returns
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, AttributeInfo> |
ReadTagValues(IRibbonControl)
Reads the tag values.
Declaration
public static Dictionary<string, string> ReadTagValues(this IRibbonControl control)
Parameters
Type | Name | Description |
---|---|---|
Microsoft.Office.Core.IRibbonControl | control | The control. |
Returns
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, System.String> |
ReadTagValues(String)
Reads the tag values.
Declaration
public static Dictionary<string, string> ReadTagValues(this string tag)
Parameters
Type | Name | Description |
---|---|---|
System.String | tag | The tag. |
Returns
Type | Description |
---|---|
System.Collections.Generic.Dictionary<System.String, System.String> |
ResetAutoSaveRevision(PreferenceService, Nullable<Boolean>)
Resets the automatic save revision.
Declaration
public static void ResetAutoSaveRevision(this PreferenceService preferenceService, bool? autoSaveRevision)
Parameters
Type | Name | Description |
---|---|---|
PreferenceService | preferenceService | The preference service. |
System.Nullable<System.Boolean> | autoSaveRevision | The automatic save revision. |
SetOfficeResourceCulture(Thread)
Updates the office resource culture.
Declaration
public static void SetOfficeResourceCulture(this Thread thread)
Parameters
Type | Name | Description |
---|---|---|
System.Threading.Thread | thread | The thread. |
ToXml(DocumentInfo)
Serializes the DocumentInfo and generates XML.
Declaration
public static string ToXml(this DocumentInfo documentInfo)
Parameters
Type | Name | Description |
---|---|---|
DocumentInfo | documentInfo |
Returns
Type | Description |
---|---|
System.String |
ToXml(Object, String)
Generates XML.
Declaration
public static string ToXml(this object xmlPart, string xmlPartNamespace)
Parameters
Type | Name | Description |
---|---|---|
System.Object | xmlPart | |
System.String | xmlPartNamespace |
Returns
Type | Description |
---|---|
System.String |
ValidateDocumentInfo(IDocument)
Validates the document information.
Declaration
public static bool ValidateDocumentInfo(this IDocument document)
Parameters
Type | Name | Description |
---|---|---|
IDocument | document |
Returns
Type | Description |
---|---|
System.Boolean |