private void AddText(OXmlTextElement element) { //if (_paragraph == null) // AddParagraph(); AddRun(); OW.Text text = new OW.Text(element.Text); if (element.PreserveSpace) { text.Space = SpaceProcessingModeValues.Preserve; } _run.AppendChild(text); }
public OXmlTextElement _Deserialize(BsonReader bsonReader, IBsonSerializationOptions options) { OXmlTextElement element = new OXmlTextElement(); while (true) { BsonType bsonType = bsonReader.ReadBsonType(); if (bsonType == BsonType.EndOfDocument) break; string name = bsonReader.ReadName(); switch (name.ToLower()) { case "type": if (bsonType != BsonType.String) throw new PBException($"wrong type value {bsonType}"); string type = bsonReader.ReadString(); if (type.ToLower() != "text") throw new PBException($"invalid Type {type} when deserialize OXmlTextElement"); break; case "text": if (bsonType == BsonType.Null) break; if (bsonType != BsonType.String) throw new PBException($"wrong text value {bsonType}"); element.Text = bsonReader.ReadString(); break; case "preservespace": if (bsonType == BsonType.Null) break; if (bsonType != BsonType.Boolean) throw new PBException($"wrong PreserveSpace value {bsonType}"); element.PreserveSpace = bsonReader.ReadBoolean(); break; default: throw new PBException($"unknow Text value \"{name}\""); } } return element; }
private void AddText(OXmlTextElement element) { //if (_paragraph == null) // AddParagraph(); AddRun(); OW.Text text = new OW.Text(element.Text); if (element.PreserveSpace) text.Space = SpaceProcessingModeValues.Preserve; _run.AppendChild(text); }