Exemplo n.º 1
0
 public XWPFSettings()
     : base()
 {
     ctSettings = new CT_Settings();
 }
Exemplo n.º 2
0
 private void ReadFrom(Stream inputStream)
 {
     //try
     //{
         XmlDocument xmldoc = ConvertStreamToXml(inputStream);
         ctSettings = SettingsDocument.Parse(xmldoc,NamespaceManager).Settings;
     //}
     //catch (Exception e)
     //{
     //    throw new Exception("SettingsDocument parse failed", e);
     //}
 }
Exemplo n.º 3
0
 public static CT_Settings Parse(XmlNode node, XmlNamespaceManager namespaceManager)
 {
     if (node == null)
         return null;
     CT_Settings ctObj = new CT_Settings();
     ctObj.activeWritingStyle = new List<CT_WritingStyle>();
     ctObj.docVars = new List<CT_DocVar>();
     ctObj.attachedSchema = new List<CT_String>();
     ctObj.smartTagType = new List<CT_SmartTagType>();
     ctObj.schemaLibrary = new List<CT_Schema>();
     foreach (XmlNode childNode in node.ChildNodes)
     {
         if (childNode.LocalName == "writeProtection")
             ctObj.writeProtection = CT_WriteProtection.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "view")
             ctObj.view = CT_View.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "zoom")
             ctObj.zoom = CT_Zoom.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "removePersonalInformation")
             ctObj.removePersonalInformation = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "removeDateAndTime")
             ctObj.removeDateAndTime = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "doNotDisplayPageBoundaries")
             ctObj.doNotDisplayPageBoundaries = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "displayBackgroundShape")
             ctObj.displayBackgroundShape = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "printPostScriptOverText")
             ctObj.printPostScriptOverText = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "printFractionalCharacterWidth")
             ctObj.printFractionalCharacterWidth = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "printFormsData")
             ctObj.printFormsData = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "embedTrueTypeFonts")
             ctObj.embedTrueTypeFonts = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "embedSystemFonts")
             ctObj.embedSystemFonts = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "saveSubsetFonts")
             ctObj.saveSubsetFonts = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "saveFormsData")
             ctObj.saveFormsData = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "mirrorMargins")
             ctObj.mirrorMargins = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "alignBordersAndEdges")
             ctObj.alignBordersAndEdges = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "bordersDoNotSurroundHeader")
             ctObj.bordersDoNotSurroundHeader = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "bordersDoNotSurroundFooter")
             ctObj.bordersDoNotSurroundFooter = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "gutterAtTop")
             ctObj.gutterAtTop = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "hideSpellingErrors")
             ctObj.hideSpellingErrors = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "hideGrammaticalErrors")
             ctObj.hideGrammaticalErrors = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "proofState")
             ctObj.proofState = CT_Proof.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "formsDesign")
             ctObj.formsDesign = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "attachedTemplate")
             ctObj.attachedTemplate = CT_Rel.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "linkStyles")
             ctObj.linkStyles = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "stylePaneFormatFilter")
             ctObj.stylePaneFormatFilter = CT_ShortHexNumber.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "stylePaneSortMethod")
             ctObj.stylePaneSortMethod = CT_ShortHexNumber.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "documentType")
             ctObj.documentType = CT_DocType.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "mailMerge")
             ctObj.mailMerge = CT_MailMerge.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "revisionView")
             ctObj.revisionView = CT_TrackChangesView.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "trackRevisions")
             ctObj.trackRevisions = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "doNotTrackMoves")
             ctObj.doNotTrackMoves = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "doNotTrackFormatting")
             ctObj.doNotTrackFormatting = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "documentProtection")
             ctObj.documentProtection = CT_DocProtect.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "autoFormatOverride")
             ctObj.autoFormatOverride = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "styleLockTheme")
             ctObj.styleLockTheme = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "styleLockQFSet")
             ctObj.styleLockQFSet = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "defaultTabStop")
             ctObj.defaultTabStop = CT_TwipsMeasure.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "autoHyphenation")
             ctObj.autoHyphenation = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "consecutiveHyphenLimit")
             ctObj.consecutiveHyphenLimit = CT_DecimalNumber.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "hyphenationZone")
             ctObj.hyphenationZone = CT_TwipsMeasure.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "doNotHyphenateCaps")
             ctObj.doNotHyphenateCaps = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "showEnvelope")
             ctObj.showEnvelope = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "summaryLength")
             ctObj.summaryLength = CT_DecimalNumber.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "clickAndTypeStyle")
             ctObj.clickAndTypeStyle = CT_String.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "defaultTableStyle")
             ctObj.defaultTableStyle = CT_String.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "evenAndOddHeaders")
             ctObj.evenAndOddHeaders = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "bookFoldRevPrinting")
             ctObj.bookFoldRevPrinting = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "bookFoldPrinting")
             ctObj.bookFoldPrinting = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "bookFoldPrintingSheets")
             ctObj.bookFoldPrintingSheets = CT_DecimalNumber.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "drawingGridHorizontalSpacing")
             ctObj.drawingGridHorizontalSpacing = CT_TwipsMeasure.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "drawingGridVerticalSpacing")
             ctObj.drawingGridVerticalSpacing = CT_TwipsMeasure.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "displayHorizontalDrawingGridEvery")
             ctObj.displayHorizontalDrawingGridEvery = CT_DecimalNumber.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "displayVerticalDrawingGridEvery")
             ctObj.displayVerticalDrawingGridEvery = CT_DecimalNumber.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "doNotUseMarginsForDrawingGridOrigin")
             ctObj.doNotUseMarginsForDrawingGridOrigin = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "drawingGridHorizontalOrigin")
             ctObj.drawingGridHorizontalOrigin = CT_TwipsMeasure.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "drawingGridVerticalOrigin")
             ctObj.drawingGridVerticalOrigin = CT_TwipsMeasure.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "doNotShadeFormData")
             ctObj.doNotShadeFormData = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "noPunctuationKerning")
             ctObj.noPunctuationKerning = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "characterSpacingControl")
             ctObj.characterSpacingControl = CT_CharacterSpacing.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "printTwoOnOne")
             ctObj.printTwoOnOne = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "strictFirstAndLastChars")
             ctObj.strictFirstAndLastChars = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "noLineBreaksAfter")
             ctObj.noLineBreaksAfter = CT_Kinsoku.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "noLineBreaksBefore")
             ctObj.noLineBreaksBefore = CT_Kinsoku.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "savePreviewPicture")
             ctObj.savePreviewPicture = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "doNotValidateAgainstSchema")
             ctObj.doNotValidateAgainstSchema = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "saveInvalidXml")
             ctObj.saveInvalidXml = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "ignoreMixedContent")
             ctObj.ignoreMixedContent = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "alwaysShowPlaceholderText")
             ctObj.alwaysShowPlaceholderText = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "doNotDemarcateInvalidXml")
             ctObj.doNotDemarcateInvalidXml = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "saveXmlDataOnly")
             ctObj.saveXmlDataOnly = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "useXSLTWhenSaving")
             ctObj.useXSLTWhenSaving = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "saveThroughXslt")
             ctObj.saveThroughXslt = CT_SaveThroughXslt.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "showXMLTags")
             ctObj.showXMLTags = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "alwaysMergeEmptyNamespace")
             ctObj.alwaysMergeEmptyNamespace = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "updateFields")
             ctObj.updateFields = CT_OnOff.Parse(childNode, namespaceManager);
         //else if(childNode.LocalName == "hdrShapeDefaults")
         //    ctObj.hdrShapeDefaults = XmlElement[].Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "footnotePr")
             ctObj.footnotePr = CT_FtnDocProps.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "endnotePr")
             ctObj.endnotePr = CT_EdnDocProps.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "compat")
             ctObj.compat = CT_Compat.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "rsids")
             ctObj.rsids = CT_DocRsids.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "mathPr")
             ctObj.mathPr = CT_MathPr.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "uiCompat97To2003")
             ctObj.uiCompat97To2003 = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "themeFontLang")
             ctObj.themeFontLang = CT_Language.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "clrSchemeMapping")
             ctObj.clrSchemeMapping = CT_ColorSchemeMapping.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "doNotIncludeSubdocsInStats")
             ctObj.doNotIncludeSubdocsInStats = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "doNotAutoCompressPictures")
             ctObj.doNotAutoCompressPictures = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "forceUpgrade")
             ctObj.forceUpgrade = new CT_Empty();
         else if (childNode.LocalName == "captions")
             ctObj.captions = CT_Captions.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "readModeInkLockDown")
             ctObj.readModeInkLockDown = CT_ReadingModeInkLockDown.Parse(childNode, namespaceManager);
         //else if(childNode.LocalName == "shapeDefaults")
         //    ctObj.shapeDefaults = XmlElement[].Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "doNotEmbedSmartTags")
             ctObj.doNotEmbedSmartTags = CT_OnOff.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "decimalSymbol")
             ctObj.decimalSymbol = CT_String.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "listSeparator")
             ctObj.listSeparator = CT_String.Parse(childNode, namespaceManager);
         else if (childNode.LocalName == "activeWritingStyle")
             ctObj.activeWritingStyle.Add(CT_WritingStyle.Parse(childNode, namespaceManager));
         else if (childNode.LocalName == "docVars")
             ctObj.docVars.Add(CT_DocVar.Parse(childNode, namespaceManager));
         else if (childNode.LocalName == "attachedSchema")
             ctObj.attachedSchema.Add(CT_String.Parse(childNode, namespaceManager));
         else if (childNode.LocalName == "smartTagType")
             ctObj.smartTagType.Add(CT_SmartTagType.Parse(childNode, namespaceManager));
         else if (childNode.LocalName == "schemaLibrary")
             ctObj.schemaLibrary.Add(CT_Schema.Parse(childNode, namespaceManager));
     }
     return ctObj;
 }
Exemplo n.º 4
0
 private void ReadFrom(Stream inputStream)
 {
     try
     {
         ctSettings = SettingsDocument.Parse(inputStream).Settings;
     }
     catch (Exception e)
     {
         throw new Exception("SettingsDocument parse failed", e);
     }
 }
Exemplo n.º 5
0
 public SettingsDocument(CT_Settings settings)
 {
     this.settings = settings;
 }
Exemplo n.º 6
0
 public SettingsDocument()
 {
     settings = new CT_Settings();
 }