/// <summary> /// CT_MathPr class constructor /// </summary> public CT_MathPr() { this.naryLimField = new CT_LimLoc(); this.intLimField = new CT_LimLoc(); //this.intraSpField = new CT_TwipsMeasure(); //this.interSpField = new CT_TwipsMeasure(); //this.postSpField = new CT_TwipsMeasure(); //this.preSpField = new CT_TwipsMeasure(); this.defJcField = new CT_OMathJc(); this.rMarginField = new CT_TwipsMeasure(); this.lMarginField = new CT_TwipsMeasure(); //this.dispDefField = new CT_OnOff(); this.smallFracField = new CT_OnOff(); this.brkBinSubField = new CT_BreakBinSub(); this.brkBinField = new CT_BreakBin(); this.mathFontField = new CT_String(); this.mathFont.val = "Cambria Math"; this.brkBin.val = ST_BreakBin.before; this.brkBinSub.val = ST_BreakBinSub.Item; this.smallFrac.val = ST_OnOff.off; this.lMargin.val = 0; this.rMargin.val = 0; this.defJc.val = ST_Jc.centerGroup; this.itemField = new CT_TwipsMeasure(); (this.Item as CT_TwipsMeasure).val = 1440; this.itemElementName = "wrapIndent"; this.intLim.val = ST_LimLoc.subSup; this.naryLim.val = ST_LimLoc.undOvr; }
/** * Set the table style. If the style is not defined in the document, MS Word * will Set the table style to "Normal". * @param styleName - the style name to apply to this table */ public void SetStyleID(String styleName) { CT_TblPr tblPr = GetTrPr(); CT_String styleStr = tblPr.tblStyle; if (styleStr == null) { styleStr = tblPr.AddNewTblStyle(); } styleStr.val = (styleName); }
public void SetStyle(string styleId) { CT_RPr pr = GetCTR().rPr; if (null == pr) { pr = GetCTR().AddNewRPr(); } CT_String style = pr.rStyle != null ? pr.rStyle : pr.AddNewRStyle(); style.val = styleId; }
public static CT_PivotCacheRecords Parse(XElement node, XmlNamespaceManager namespaceManager) { if (node == null) { return(null); } CT_PivotCacheRecords ctObj = new CT_PivotCacheRecords(); if (node.Attribute("count") != null) { ctObj.count = XmlHelper.ReadUInt(node.Attribute("count")); } ctObj.r = new List <Object>(); foreach (XElement childNode in node.ChildElements()) { if (childNode.Name.LocalName == "extLst") { ctObj.extLst = CT_ExtensionList.Parse(childNode, namespaceManager); } else if (childNode.Name.LocalName == "n") { ctObj.r.Add(CT_Number.Parse(childNode, namespaceManager)); } else if (childNode.Name.LocalName == "b") { ctObj.r.Add(CT_Boolean.Parse(childNode, namespaceManager)); } else if (childNode.Name.LocalName == "d") { ctObj.r.Add(CT_DateTime.Parse(childNode, namespaceManager)); } else if (childNode.Name.LocalName == "e") { ctObj.r.Add(CT_Error.Parse(childNode, namespaceManager)); } else if (childNode.Name.LocalName == "m") { ctObj.r.Add(CT_Missing.Parse(childNode, namespaceManager)); } else if (childNode.Name.LocalName == "s") { ctObj.r.Add(CT_String.Parse(childNode, namespaceManager)); } else if (childNode.Name.LocalName == "x") { ctObj.r.Add(CT_Index.Parse(childNode, namespaceManager)); } } return(ctObj); }
public string GetStyleID() { string str = (string)null; CT_TblPr tblPr = this.ctTbl.tblPr; if (tblPr != null) { CT_String tblStyle = tblPr.tblStyle; if (tblStyle != null) { str = tblStyle.val; } } return(str); }
/** * Get the StyleID of the table * @return style-ID of the table */ public String GetStyleID() { String styleId = null; CT_TblPr tblPr = ctTbl.tblPr; if (tblPr != null) { CT_String styleStr = tblPr.tblStyle; if (styleStr != null) { styleId = styleStr.val; } } return(styleId); }
public void TestSetTableDescription() { // create a table XWPFDocument doc = new XWPFDocument(); CT_Tbl ctTable = new CT_Tbl(); XWPFTable table = new XWPFTable(ctTable, doc); //Set Description table.TableDescription = "%TABLEDESCRIPTION%"; //Check CT_String tblDesc = table.GetCTTbl().tblPr.tblDescription; Assert.IsNotNull(tblDesc); Assert.AreEqual("%TABLEDESCRIPTION%", tblDesc.val); }
/// <summary> /// Return this run's style ID. If this run has no style (no run properties or properties without a style), an empty string is returned. /// </summary> /// <returns></returns> public string GetStyle() { CT_RPr pr = GetCTR().rPr; if (pr == null) { return(""); } CT_String style = pr.rStyle; if (style == null) { return(""); } return(style.val); }
/// <summary> /// 加入标题定义 /// </summary> /// <param name="docxDocument"></param> /// <param name="strStyleId"></param> /// <param name="headingLevel"></param> private static void addCustomHeadingStyle(XWPFDocument docxDocument, String strStyleId, int headingLevel) { CT_Style ctStyle = new CT_Style(); ctStyle.styleId = strStyleId; CT_String styleName = new CT_String(); styleName.val = strStyleId; ctStyle.name = styleName; CT_DecimalNumber indentNumber = new CT_DecimalNumber(); indentNumber.val = BigInteger.ValueOf(headingLevel).ToString(); // lower number > style is more prominent in the formats bar ctStyle.uiPriority = indentNumber; CT_OnOff onoffnull = new CT_OnOff(); ctStyle.unhideWhenUsed = onoffnull; // style shows up in the formats bar ctStyle.qFormat = onoffnull; // style defines a heading of the given level CT_PPr ppr = new CT_PPr(); ppr.outlineLvl = indentNumber; ctStyle.pPr = ppr; XWPFStyle style = new XWPFStyle(ctStyle); // is a null op if already defined XWPFStyles styles = docxDocument.CreateStyles(); style.StyleType = ST_StyleType.paragraph; if (styles.GetStyle(strStyleId) == null) { styles.AddStyle(style); } }
public static CT_PivotCacheRecord Parse(XmlNode node, XmlNamespaceManager namespaceManager) { CT_PivotCacheRecord ctObj = new CT_PivotCacheRecord(); ctObj.fields = new List <object>(); foreach (XmlNode childNode in node.ChildNodes) { if (childNode.LocalName == "n") { ctObj.fields.Add(CT_Number.Parse(childNode, namespaceManager)); } else if (childNode.LocalName == "b") { ctObj.fields.Add(CT_Boolean.Parse(childNode, namespaceManager)); } else if (childNode.LocalName == "d") { ctObj.fields.Add(CT_DateTime.Parse(childNode, namespaceManager)); } else if (childNode.LocalName == "e") { ctObj.fields.Add(CT_Error.Parse(childNode, namespaceManager)); } else if (childNode.LocalName == "m") { ctObj.fields.Add(CT_Missing.Parse(childNode, namespaceManager)); } else if (childNode.LocalName == "s") { ctObj.fields.Add(CT_String.Parse(childNode, namespaceManager)); } else if (childNode.LocalName == "x") { ctObj.fields.Add(CT_Index.Parse(childNode, namespaceManager)); } } return(ctObj); }
public void AddCustomHeadingStyle(string name, int headingLevel, int outlineLevel, int ptSize = 12) { CT_Style ctStyle = ctStyles.AddNewStyle(); ctStyle.styleId = (name); CT_String styleName = new CT_String(); styleName.val = (name); ctStyle.name = (styleName); CT_DecimalNumber indentNumber = new CT_DecimalNumber(); indentNumber.val = headingLevel.ToString(); // lower number > style is more prominent in the formats bar ctStyle.uiPriority = (indentNumber); CT_OnOff onoffnull = new CT_OnOff(); ctStyle.unhideWhenUsed = (onoffnull); // style shows up in the formats bar ctStyle.qFormat = (onoffnull); // style defines a heading of the given level CT_PPr ppr = new CT_PPr(); ppr.outlineLvl = new CT_DecimalNumber() { val = outlineLevel.ToString() }; ctStyle.pPr = (ppr); CT_RPr rpr = new CT_RPr(); rpr.AddNewSz().val = (ulong)ptSize * 2; ctStyle.rPr = rpr; }
public static CT_String Parse(XmlNode node, XmlNamespaceManager namespaceManager) { if (node == null) return null; CT_String ctObj = new CT_String(); ctObj.val = XmlHelper.ReadString(node.Attributes["m:val"]); return ctObj; }
public CT_Settings() { this.listSeparatorField = new CT_String(); this.listSeparator.val = ","; this.decimalSymbolField = new CT_String(); this.decimalSymbol.val = "."; //this.doNotEmbedSmartTagsField = new CT_OnOff(); this.shapeDefaultsField = new System.Xml.XmlElement[0]; //this.schemaLibraryField = new List<CT_Schema>(); //this.smartTagTypeField = new List<CT_SmartTagType>(); //this.readModeInkLockDownField = new CT_ReadingModeInkLockDown(); //this.captionsField = new CT_Captions(); //this.forceUpgradeField = new CT_Empty(); //this.doNotAutoCompressPicturesField = new CT_OnOff(); //this.doNotIncludeSubdocsInStatsField = new CT_OnOff(); this.clrSchemeMappingField = new CT_ColorSchemeMapping(); this.clrSchemeMapping.bg1 = ST_ColorSchemeIndex.light1; this.clrSchemeMapping.t1 = ST_ColorSchemeIndex.dark1; this.clrSchemeMapping.bg2 = ST_ColorSchemeIndex.light2; this.clrSchemeMapping.t2 = ST_ColorSchemeIndex.dark2; this.clrSchemeMapping.accent1 = ST_ColorSchemeIndex.accent1; this.clrSchemeMapping.accent2 = ST_ColorSchemeIndex.accent2; this.clrSchemeMapping.accent3 = ST_ColorSchemeIndex.accent3; this.clrSchemeMapping.accent4 = ST_ColorSchemeIndex.accent4; this.clrSchemeMapping.accent5 = ST_ColorSchemeIndex.accent5; this.clrSchemeMapping.accent6 = ST_ColorSchemeIndex.accent6; this.clrSchemeMapping.hyperlink = ST_ColorSchemeIndex.hyperlink; this.clrSchemeMapping.followedHyperlink = ST_ColorSchemeIndex.followedHyperlink; this.themeFontLangField = new CT_Language(); this.themeFontLang.val = "en-US"; this.themeFontLang.eastAsia = "zh-CN"; //this.attachedSchemaField = new List<CT_String>(); //this.uiCompat97To2003Field = new CT_OnOff(); this.mathPrField = new NPOI.OpenXmlFormats.Shared.CT_MathPr(); this.rsidsField = new CT_DocRsids(); //this.docVarsField = new List<CT_DocVar>(); this.compatField = new CT_Compat(); //this.endnotePrField = new CT_EdnDocProps(); //this.footnotePrField = new CT_FtnDocProps(); //this.hdrShapeDefaultsField = new System.Xml.XmlElement[0]; //this.updateFieldsField = new CT_OnOff(); //this.alwaysMergeEmptyNamespaceField = new CT_OnOff(); //this.showXMLTagsField = new CT_OnOff(); //this.saveThroughXsltField = new CT_SaveThroughXslt(); //this.useXSLTWhenSavingField = new CT_OnOff(); //this.saveXmlDataOnlyField = new CT_OnOff(); //this.doNotDemarcateInvalidXmlField = new CT_OnOff(); //this.alwaysShowPlaceholderTextField = new CT_OnOff(); //this.ignoreMixedContentField = new CT_OnOff(); //this.saveInvalidXmlField = new CT_OnOff(); //this.doNotValidateAgainstSchemaField = new CT_OnOff(); //this.savePreviewPictureField = new CT_OnOff(); //this.noLineBreaksBeforeField = new CT_Kinsoku(); //this.noLineBreaksAfterField = new CT_Kinsoku(); //this.strictFirstAndLastCharsField = new CT_OnOff(); //this.printTwoOnOneField = new CT_OnOff(); this.characterSpacingControlField = new CT_CharacterSpacing(); this.characterSpacingControl.val = ST_CharacterSpacing.compressPunctuation; //this.noPunctuationKerningField = new CT_OnOff(); //this.doNotShadeFormDataField = new CT_OnOff(); //this.drawingGridVerticalOriginField = new CT_TwipsMeasure(); //this.drawingGridHorizontalOriginField = new CT_TwipsMeasure(); //this.doNotUseMarginsForDrawingGridOriginField = new CT_OnOff(); this.displayVerticalDrawingGridEveryField = new CT_DecimalNumber(); this.displayVerticalDrawingGridEvery.val = "2"; this.displayHorizontalDrawingGridEveryField = new CT_DecimalNumber(); this.displayHorizontalDrawingGridEvery.val = "0"; this.drawingGridVerticalSpacingField = new CT_TwipsMeasure(); this.drawingGridVerticalSpacing.val = 156; //this.drawingGridHorizontalSpacingField = new CT_TwipsMeasure(); //this.bookFoldPrintingSheetsField = new CT_DecimalNumber(); //this.bookFoldPrintingField = new CT_OnOff(); //this.bookFoldRevPrintingField = new CT_OnOff(); //this.evenAndOddHeadersField = new CT_OnOff(); //this.defaultTableStyleField = new CT_String(); //this.clickAndTypeStyleField = new CT_String(); //this.summaryLengthField = new CT_DecimalNumber(); //this.showEnvelopeField = new CT_OnOff(); //this.doNotHyphenateCapsField = new CT_OnOff(); //this.hyphenationZoneField = new CT_TwipsMeasure(); //this.consecutiveHyphenLimitField = new CT_DecimalNumber(); //this.autoHyphenationField = new CT_OnOff(); this.defaultTabStopField = new CT_TwipsMeasure(); this.defaultTabStopField.val = 420; //this.styleLockQFSetField = new CT_OnOff(); //this.styleLockThemeField = new CT_OnOff(); //this.autoFormatOverrideField = new CT_OnOff(); //this.documentProtectionField = new CT_DocProtect(); //this.doNotTrackFormattingField = new CT_OnOff(); //this.doNotTrackMovesField = new CT_OnOff(); //this.trackRevisionsField = new CT_OnOff(); //this.revisionViewField = new CT_TrackChangesView(); //this.mailMergeField = new CT_MailMerge(); //this.documentTypeField = new CT_DocType(); //this.stylePaneSortMethodField = new CT_ShortHexNumber(); //this.stylePaneFormatFilterField = new CT_ShortHexNumber(); //this.linkStylesField = new CT_OnOff(); //this.attachedTemplateField = new CT_Rel(); //this.formsDesignField = new CT_OnOff(); //this.proofStateField = new CT_Proof(); //this.activeWritingStyleField = new List<CT_WritingStyle>(); //this.hideGrammaticalErrorsField = new CT_OnOff(); //this.hideSpellingErrorsField = new CT_OnOff(); //this.gutterAtTopField = new CT_OnOff(); this.bordersDoNotSurroundFooterField = new CT_OnOff(); this.bordersDoNotSurroundHeaderField = new CT_OnOff(); //this.alignBordersAndEdgesField = new CT_OnOff(); //this.mirrorMarginsField = new CT_OnOff(); //this.saveFormsDataField = new CT_OnOff(); //this.saveSubsetFontsField = new CT_OnOff(); //this.embedSystemFontsField = new CT_OnOff(); //this.embedTrueTypeFontsField = new CT_OnOff(); //this.printFormsDataField = new CT_OnOff(); //this.printFractionalCharacterWidthField = new CT_OnOff(); //this.printPostScriptOverTextField = new CT_OnOff(); //this.displayBackgroundShapeField = new CT_OnOff(); //this.doNotDisplayPageBoundariesField = new CT_OnOff(); //this.removeDateAndTimeField = new CT_OnOff(); //this.removePersonalInformationField = new CT_OnOff(); this.zoomField = new CT_Zoom(); //this.viewField = new CT_View(); //this.writeProtectionField = new CT_WriteProtection(); }
public CT_CustomXmlPr() { this.attrField = new List<CT_Attr>(); this.placeholderField = new CT_String(); }