Ejemplo n.º 1
0
        private static void ProcessText(XDocument xdoc)
        {
            System.Collections.Generic.IEnumerable <XElement> attributesToDelete = from ele in xdoc.Descendants()
                                                                                   where ele != null && ele.Attribute("Text") != null
                                                                                   select ele;

            try
            {
                foreach (XAttribute attribute in attributesToDelete.Attributes())
                {
                    XElement parent = attribute.Parent;

                    System.Collections.Generic.IEnumerable <XElement> toDelete = from ele in xdoc.Descendants()
                                                                                 where ele != null && ele.Attribute("Text") != null
                                                                                 select ele;

                    foreach (XAttribute att in toDelete.Attributes())
                    {
                        att.Remove();
                    }

                    parent.SetAttributeValue("TextColor", $"#{LayoutBuilder.GetColor(true).ToHex()}");
                    parent.SetAttributeValue("Text", TextBuilder.GenerateLoremText(attribute.Value));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
Ejemplo n.º 2
0
        private static void RemoveBackGroundColor(XDocument xdoc)
        {
            System.Collections.Generic.IEnumerable <XElement> attributesToDelete = from ele in xdoc.Descendants()
                                                                                   where ele != null && ele.Attribute("BackgroundColor") != null
                                                                                   select ele;

            try
            {
                foreach (XAttribute attribute in attributesToDelete.Attributes())
                {
                    attribute.Remove();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }