Exemplo n.º 1
0
        private void FillCell(TableCell cell, IEnumerable <XElement> snippets, Page source)
        {
            var link   = one.GetHyperlink(source.PageId, string.Empty);
            var match  = Regex.Match(link, @"page-id=({[^}]+?})");
            var linkId = match.Success ? match.Groups[1].Value : string.Empty;

            var tagmap        = page.MergeTagDefs(source);
            var quickmap      = page.MergeQuickStyles(source);
            var citationIndex = page.GetQuickStyle(Styles.StandardStyles.Citation).Index;

            var text = $"<a href=\"{link}\">Embedded from {source.Title}</a> | <a " +
                       $"href=\"onemore://EmbedSubpageProxy/true/{source.PageId}/{linkId}\">{Resx.word_Refresh}</a>";

            var header = new Paragraph(text)
                         .SetQuickStyle(citationIndex)
                         .SetStyle("font-style:italic")
                         .SetAlignment("right");

            header.AddFirst(new Meta(EmbedHeaderMetaName, "1"));

            cell.SetContent(new XElement(ns + "OEChildren", header));

            foreach (var snippet in snippets)
            {
                page.ApplyStyleMapping(quickmap, snippet);
                page.ApplyTagDefMapping(tagmap, snippet);

                cell.Root.Add(snippet);
            }
        }