Class HtmlTransformator
Transforms the received Html in html that can be displayed and maintained in the modern client side text part
Inherited Members
Namespace: PnP.Framework.Modernization.Transform
Assembly: PnP.Framework.dll
Syntax
public class HtmlTransformator : BaseTransform, IHtmlTransformator
Constructors
HtmlTransformator(IList<ILogObserver>)
Default constructor
Declaration
public HtmlTransformator(IList<ILogObserver> logObservers = null)
Parameters
|
IList<ILogObserver>
logObservers
|
Methods
CleanHtmlNodes(IHtmlDocument)
Declaration
protected virtual void CleanHtmlNodes(IHtmlDocument document)
Parameters
|
IHtmlDocument
document
|
CleanStyles(IHtmlDocument)
Declaration
protected virtual void CleanStyles(IHtmlDocument document)
Parameters
|
IHtmlDocument
document
|
ColorCodeToBackgroundColorName(Int32)
Translated SharePoint Wiki background color number (ms-rtebackcolor-5 means number 5 is used) to RTE compatible color name
Declaration
public static string ColorCodeToBackgroundColorName(int colorCode)
Parameters
|
System.Int32
colorCode
Used color number |
Returns
|
System.String
RTE color string |
ColorCodeToForegroundColorName(Int32)
Translated SharePoint Wiki foreground color number (ms-rteforecolor-2 means number 2 is used) to RTE compatible color name
Declaration
public static string ColorCodeToForegroundColorName(int colorCode)
Parameters
|
System.Int32
colorCode
Used color number |
Returns
|
System.String
RTE color string |
DropBRs(IHtmlDocument)
Declaration
protected virtual void DropBRs(IHtmlDocument document)
Parameters
|
IHtmlDocument
document
|
FontCodeToName(Int32)
Translates SharePoint wiki font size (e.g. ms-rtefontsize-3 means font size 3) to RTE font size name
Declaration
public static string FontCodeToName(int fontCode)
Parameters
|
System.Int32
fontCode
Wiki font size code |
Returns
|
System.String
RTE font size name |
ImageIFramePlaceHolders(IHtmlDocument)
Declaration
protected virtual void ImageIFramePlaceHolders(IHtmlDocument document)
Parameters
|
IHtmlDocument
document
|
IsEmptyParagraph(String)
Returns true is the passed html is "empty"
Declaration
public bool IsEmptyParagraph(string text)
Parameters
|
System.String
text
Html to verify |
Returns
|
System.Boolean
True if considered empty, false otherwise |
TableStyleCodeToName(Int32)
Map wiki table style to a RTE compatible style
Declaration
public static string TableStyleCodeToName(int tableStyleCode)
Parameters
|
System.Int32
tableStyleCode
Code used for the wiki table style |
Returns
|
System.String
RTE compatible table style |
Remarks
Filled-header, banded, and bordered-header styles emphasize the first row. Transformation uses a neutral grid for headerless tables, preserving banded fills as native cell backgrounds.
ThemeCodeToForegroundColorName(Int32)
Translated SharePoint Wiki foreground theme color number (e.g. ms-rteThemeForeColor-6-1) to RTE compatible color name
Declaration
public static string ThemeCodeToForegroundColorName(int themeCode)
Parameters
|
System.Int32
themeCode
Theme color code |
Returns
|
System.String
RTE color string |
Transform(String, Boolean)
Transforms the passed html to be usable by the client side text part
Declaration
public string Transform(string text, bool usePlaceHolder)
Parameters
|
System.String
text
Html to be transformed |
|
System.Boolean
usePlaceHolder
Insert placeholders for images and iframe tags |
Returns
|
System.String
Html that can be used and edited via the client side text part |
Implements
Remarks
Source fragment destinations are retained, with heading IDs placed on content spans because modern rendering generates its own heading IDs. Those generated IDs can collide with source IDs. The modern text editor can discard custom IDs on a subsequent edit/save; preserving them here does not prevent that editor behavior. Ordered lists retain their inline or HTML type marker style (decimal by default) at every nesting level, using native RTE list markup instead of the modern renderer's implicit alphabetic nested markers.
TransformBlockQuotes(IHtmlCollection<IElement>, IHtmlDocument)
Declaration
protected virtual void TransformBlockQuotes(IHtmlCollection<IElement> blockQuotes, IHtmlDocument document)
Parameters
|
IHtmlCollection<IElement>
blockQuotes
|
|
IHtmlDocument
document
|
TransformElements(IHtmlCollection<IElement>, IHtmlDocument)
Declaration
protected virtual void TransformElements(IHtmlCollection<IElement> elementsToTransform, IHtmlDocument document)
Parameters
|
IHtmlCollection<IElement>
elementsToTransform
|
|
IHtmlDocument
document
|
TransformHeadings(IHtmlDocument, Int32, Int32)
Declaration
protected virtual void TransformHeadings(IHtmlDocument document, int from, int to)
Parameters
|
IHtmlDocument
document
|
|
System.Int32
from
|
|
System.Int32
to
|
TransformTables(IHtmlCollection<IElement>, IHtmlDocument)
Preserves table spans and relative column sizing in native canvas RTE markup that fits the canvas. Absolute table widths become responsive widths because RTE does not retain overflow constraints. Tables without explicit sizing, spans, or cell backgrounds retain the legacy wrapper. Nested tables remain in their owning cells for canvas RTE to render and edit.
Declaration
protected virtual void TransformTables(IHtmlCollection<IElement> tables, IHtmlDocument document)
Parameters
|
IHtmlCollection<IElement>
tables
|
|
IHtmlDocument
document
|