本文整理汇总了C#中OpenXmlElement类的典型用法代码示例。如果您正苦于以下问题:C# OpenXmlElement类的具体用法?C# OpenXmlElement怎么用?C# OpenXmlElement使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OpenXmlElement类属于命名空间,在下文中一共展示了OpenXmlElement类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: ApplyFontStyle
internal static void ApplyFontStyle(string style, OpenXmlElement styleElement)
{
if (string.Compare(italic, style, StringComparison.InvariantCultureIgnoreCase) == 0)
{
styleElement.Append(new Italic());
}
}
开发者ID:kannan-ar,项目名称:MariGold.OpenXHTML,代码行数:7,代码来源:DocxFontStyle.cs
示例2: SetMarginBottom
private void SetMarginBottom(OpenXmlElement parent)
{
Paragraph para = parent.AppendChild(new Paragraph());
para.ParagraphProperties = new ParagraphProperties();
DocxMargin.SetBottomMargin(defaultDLMargin, para.ParagraphProperties);
}
开发者ID:kannan-ar,项目名称:MariGold.OpenXHTML,代码行数:7,代码来源:DocxDL.cs
示例3: InsertAfter
public override void InsertAfter(OpenXmlElement openXmlNode, MainDocumentPart mainDocumentPart)
{
_mainDocumentPart = mainDocumentPart;
var imagePart = CreateImagePart();
openXmlNode.InsertAfterSelf(CreateImageElement(mainDocumentPart.GetIdOfPart(imagePart), Path.GetFileName(_content)));
}
开发者ID:Geaz,项目名称:SharpDox.Plugins.Word,代码行数:7,代码来源:Image.cs
示例4: AppendTo
public override void AppendTo(OpenXmlElement openXmlNode, MainDocumentPart mainDocumentPart)
{
_mainDocumentPart = mainDocumentPart;
var imagePart = CreateImagePart();
openXmlNode.Append(CreateImageElement(mainDocumentPart.GetIdOfPart(imagePart), Path.GetFileName(_content)));
}
开发者ID:Geaz,项目名称:SharpDox.Plugins.Word,代码行数:7,代码来源:Image.cs
示例5: CreateParagraph
private Paragraph CreateParagraph(DocxNode node, OpenXmlElement parent)
{
Paragraph para = parent.AppendChild(new Paragraph());
OnParagraphCreated(node, para);
OnOLParagraphCreated(this, new ParagraphEventArgs(para));
return para;
}
开发者ID:kannan-ar,项目名称:MariGold.OpenXHTML,代码行数:7,代码来源:DocxOL.cs
示例6: GetXPath
/// <summary>
/// Gets XmlPath information of the specified OpenXmlElement.
/// </summary>
/// <param name="element">The OpenXmlElement.</param>
/// <returns>XmlPath to this element from root element.</returns>
internal static XmlPath GetXPath(OpenXmlElement element)
{
if (element == null)
{
return null;
// throw new ArgumentNullException("element");
}
XmlPath xmlPath = new XmlPath();
xmlPath.PartUri = element.GetPartUri();
Dictionary<string, string> namespaces = new Dictionary<string, string>();
StringBuilder xpath = new StringBuilder("");
BuildXPath(element, xpath, namespaces);
xmlPath.XPath = xpath.ToString();
StringBuilder nsString;
foreach (var ns in namespaces)
{
nsString = new StringBuilder("");
nsString.Append("xmlns:");
nsString.Append(ns.Key);
nsString.Append("=\"");
nsString.Append(ns.Value);
nsString.Append("\"");
xmlPath.NamespacesDefinitions.Add(nsString.ToString());
}
return xmlPath;
}
开发者ID:eriawan,项目名称:Open-XML-SDK,代码行数:40,代码来源:XmlPath.cs
示例7: ApplyFontWeight
internal static void ApplyFontWeight(string style, OpenXmlElement styleElement)
{
if (string.Compare(bold, style, StringComparison.InvariantCultureIgnoreCase) == 0 ||
string.Compare(bolder, style, StringComparison.InvariantCultureIgnoreCase) == 0)
{
styleElement.Append(new Bold());
}
}
开发者ID:kannan-ar,项目名称:MariGold.OpenXHTML,代码行数:8,代码来源:DocxFontStyle.cs
示例8: AppendTo
public override void AppendTo(OpenXmlElement openXmlNode, MainDocumentPart mainDocumentPart)
{
var paragraphs = ConvertContentToParagraphs(mainDocumentPart);
foreach (var paragraph in paragraphs)
{
openXmlNode.Append(paragraph);
}
}
开发者ID:Geaz,项目名称:SharpDox.Plugins.Word,代码行数:8,代码来源:RichText.cs
示例9: AppendTo
public override void AppendTo(OpenXmlElement openXmlNode, MainDocumentPart mainDocumentPart)
{
var text = _newParagraph
? (OpenXmlElement)new Paragraph(new Run(new Text(_content)))
: (OpenXmlElement)new Run(new Text(_content));
openXmlNode.Append(text);
}
开发者ID:Geaz,项目名称:SharpDox.Plugins.Word,代码行数:8,代码来源:PlainText.cs
示例10: ApplyTextAlign
internal static void ApplyTextAlign(string style, OpenXmlElement styleElement)
{
JustificationValues alignment;
if (GetJustificationValue(style, out alignment))
{
styleElement.Append(new Justification() { Val = alignment });
}
}
开发者ID:kannan-ar,项目名称:MariGold.OpenXHTML,代码行数:9,代码来源:DocxAlignment.cs
示例11: InsertAfter
public override void InsertAfter(OpenXmlElement openXmlNode, MainDocumentPart mainDocumentPart)
{
var paragraphs = ConvertContentToParagraphs(mainDocumentPart);
var insertPoint = openXmlNode;
foreach (var paragraph in paragraphs)
{
insertPoint.InsertAfterSelf(paragraph);
insertPoint = paragraph;
}
}
开发者ID:Geaz,项目名称:SharpDox.Plugins.Word,代码行数:10,代码来源:RichText.cs
示例12: OpenXmlDomReader
/// <summary>
/// Initializes a new instance of the OpenXmlDomReader class using the supplied OpenXmlElement and Boolean values.
/// </summary>
/// <param name="openXmlElement">The OpenXmlElement to read.</param>
/// <param name="readMiscNodes">Specify false to indicate to the reader to skip all miscellaneous nodes. The default value is false.</param>
public OpenXmlDomReader(OpenXmlElement openXmlElement, bool readMiscNodes)
: this(readMiscNodes)
{
if (openXmlElement == null)
{
throw new ArgumentNullException("openXmlElement");
}
this.Init(openXmlElement);
}
开发者ID:hakatashi,项目名称:frequency-counter,代码行数:15,代码来源:OpenXmlReader.cs
示例13: ApplyTextDecoration
internal static void ApplyTextDecoration(string style, OpenXmlElement styleElement)
{
if (string.Compare(style, underLine, StringComparison.InvariantCultureIgnoreCase) == 0)
{
styleElement.Append(new Underline() { Val = UnderlineValues.Single });
}
else if (string.Compare(style, lineThrough, StringComparison.InvariantCultureIgnoreCase) == 0)
{
styleElement.Append(new Strike());
}
}
开发者ID:kannan-ar,项目名称:MariGold.OpenXHTML,代码行数:11,代码来源:DocxFontStyle.cs
示例14: GetMergeRuns
public static IEnumerable<MergeField> GetMergeRuns(OpenXmlElement element)
{
// Gets each element under the element with text representing a merge field.
foreach (var run in element.Descendants<Run>())
{
if (run.InnerText.StartsWith(MergeField.StartMergeField.ToString())
&& run.InnerText.EndsWith(MergeField.EndMergeField.ToString()))
{
yield return ConvertRunToMergeField(run);
}
}
}
开发者ID:EnvironmentAgency,项目名称:prsd-iws,代码行数:12,代码来源:MergeFieldLocator.cs
示例15: AddCallBackMethod
public void AddCallBackMethod(OpenXmlElement element, CallBackMethod method)
{
if (!_callBackMethods.Keys.Contains(element.ElementTypeId))
{
_callBackMethods.Add(element.ElementTypeId, new List<CallBackMethod>());
}
// _callBackMethods[element.ElementTypeId] is a List. Let's check if the method obj is already added to the list.
if (!_callBackMethods[element.ElementTypeId].Contains(method))
{
_callBackMethods[element.ElementTypeId].Add(method);
}
}
开发者ID:ErykJaroszewicz,项目名称:Open-XML-SDK,代码行数:13,代码来源:SemanticConstraintRegistry.cs
示例16: InitializeRoot
private List<OpenXmlElement> InitializeRoot(OpenXmlElement root, bool removeOldOnes = true)
{
var initialElements = root.ChildElements;
if (removeOldOnes)
{
if (initialElements == null || initialElements.Count <= 0) return new List<OpenXmlElement>();
List<OpenXmlElement> elements =
initialElements.Select(initialElement => (OpenXmlElement) initialElement.Clone()).ToList();
root.RemoveAllChildren();
return elements;
}
return initialElements.ToList();
}
开发者ID:desautel,项目名称:Sdl-Community,代码行数:13,代码来源:WordHelperBase.cs
示例17: Validate
/// <summary>
/// Validate the DOM tree under the specified OpenXmlElement.
/// </summary>
/// <param name="schemaValidator">The schemaValidator.</param>
/// <param name="openxmlElement">The root of the sub tree.</param>
/// <returns>Returns the validation result in ValidationResult.</returns>
/// <remarks>
/// Only schema validating.
/// </remarks>
internal static ValidationResult Validate(this SchemaValidator schemaValidator, OpenXmlElement openxmlElement)
{
Debug.Assert(openxmlElement != null);
var validationResult = new ValidationResult();
Debug.Assert(!(openxmlElement is OpenXmlUnknownElement || openxmlElement is OpenXmlMiscNode));
// Can not just validate AlternateContent / Choice / Fallback
// Debug.Assert(!(openxmlElement is AlternateContent))
Debug.Assert(!(openxmlElement is AlternateContentChoice || openxmlElement is AlternateContentFallback));
var validationContext = new ValidationContext();
validationContext.ValidationErrorEventHandler += validationResult.OnValidationError;
validationContext.Element = openxmlElement;
schemaValidator.Validate(validationContext);
return validationResult;
}
开发者ID:eriawan,项目名称:Open-XML-SDK,代码行数:30,代码来源:ValidatorExtension.cs
示例18: GetPlainText
private string GetPlainText(OpenXmlElement element)
{
StringBuilder PlainTextInWord = new StringBuilder();
foreach (OpenXmlElement section in element.Elements())
{
switch (section.LocalName)
{
// Text
case "t":
PlainTextInWord.Append(section.InnerText);
break;
case "cr": // Carriage return
case "br": // Page break
PlainTextInWord.Append(Environment.NewLine);
break;
// Tab
case "tab":
PlainTextInWord.Append("\t");
break;
// Paragraph
case "p":
PlainTextInWord.Append(GetPlainText(section));
PlainTextInWord.AppendLine(Environment.NewLine);
break;
default:
PlainTextInWord.Append(GetPlainText(section));
break;
}
}
return PlainTextInWord.ToString();
}
开发者ID:zeferreira,项目名称:eDoc,代码行数:40,代码来源:DocParserDocxOpenXML.cs
示例19: GetChildMc
private static OpenXmlElement GetChildMc(this OpenXmlElement parent, OpenXmlElement child, MCContext mcContext, FileFormatVersions format)
{
// Use stack to cache the next siblings in different levels.
Stack<OpenXmlElement> nextSiblings = new Stack<OpenXmlElement>();
while (child != null)
{
var acb = child as AlternateContent;
if (acb == null && child.IsInVersion(format))
{
return child;
}
else
{
mcContext.PushMCAttributes2(child.MCAttributes, child.LookupNamespace);
if (acb != null)
{
nextSiblings.Push(child.GetNextNonMiscElementSibling());
var select = mcContext.GetContentFromACBlock(acb, format);
if (select != null)
{
child = select.GetFirstNonMiscElementChild();
}
else
{
// The ACB has no children elements.
// case like: <acb/> <acb><choice/><fallback/></acb>
child = null;
}
}
else
{
// Ignorable element, skip it
if (mcContext.IsIgnorableNs(child.NamespaceUri))
{
// Any element marked with ProcessContent should be an Ignorable Element
if (mcContext.IsProcessContent(child))
{
nextSiblings.Push(child.GetNextNonMiscElementSibling());
//
child = child.GetFirstNonMiscElementChild();
}
else
{
child = child.GetNextNonMiscElementSibling();
}
}
else
{
mcContext.PopMCAttributes2();
return child;
}
}
mcContext.PopMCAttributes2();
}
while (child == null && nextSiblings.Count > 0)
{
child = nextSiblings.Pop();
}
}
// child is null.
return child;
}
开发者ID:eriawan,项目名称:Open-XML-SDK,代码行数:65,代码来源:AlternateContentValidator.cs
示例20: GetNextChildMc
internal static OpenXmlElement GetNextChildMc(this OpenXmlElement parent, OpenXmlElement child, MCContext mcContext, FileFormatVersions format)
{
var next = child.GetNextNonMiscElementSibling();
var mcTier = child.Parent;
if (next == null && mcTier != parent)
{
// the child must be under element in ProcessContent or ACB
if (mcTier is AlternateContentChoice || mcTier is AlternateContentFallback)
{
mcTier = mcTier.Parent;
}
Debug.Assert(mcTier != null);
// there is no more next sibling in this level, then try to find the next siblig of the up level.
return parent.GetNextChildMc(mcTier, mcContext, format);
}
return parent.GetChildMc(next, mcContext, format);
}
开发者ID:eriawan,项目名称:Open-XML-SDK,代码行数:20,代码来源:AlternateContentValidator.cs
注:本文中的OpenXmlElement类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论