C# Класс IfacesEnumsStructsClasses.HTMLEditHelper

Helper class to perform HTML editing functions For example of usage, please refer to frmHTMLEditor.cs
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
HtmlAmp string
HtmlSpace string
HtmlTagClose string
HtmlTagOpen string

Открытые методы

Метод Описание
AddToSelection ( string s_BeginHtml, string s_EndHtml ) : bool

1) If nothing is selected returns false 2) If the user has selected text or multiple elements inserts s_BeginHtml before and s_EndHtml behind the current selection 3)If the user has selected a control returns false

AppendAnchor ( string href, string target ) : bool
AppendChild ( IHTMLElement parent, string TagName ) : IHTMLDOMNode

Creates and appends an HTMLElement to a parent element

AppendChild ( string TagName ) : IHTMLDOMNode

Creates and appends an HTMLElement to the end of the document DOM

AppendHr ( string align, string hrcolor, string width, bool noshade ) : bool
AppendImage ( string src, string width, string height, string border, string alignment, string alt, string hspace, string vspace, string lowsrc ) : bool
AppendTable ( int colnum, int rownum, int bordersize, string alignment, int cellpadding, int cellspacing, string widthpercentage, int widthpixel, string backcolor, string bordercolor, string lightbordercolor, string darkbordercolor ) : bool
DeleteCol ( IHTMLTable table, int colindex ) : void
DeleteRow ( IHTMLTable table, int rowindex ) : void

Deletes a given rowindex in a given table zero based If the table has no rows after deletion anymore we delete it compeletely

EmbedBr ( ) : bool

Embeds a BR tag at the selection

FindParent ( IHTMLElement elem, string ParentTagName ) : IHTMLElement

Searches for a parent (or grandparent) element with the given tag ParentTagName must be in the form "TD" "TR" "TABLE" (uppercase)

GetCaretPosition ( ) : tagPOINT

Attempts to retreive Caret position

GetCharIndexFromPos ( int clientX, int clientY ) : int

Attempts to retreive char index from given X and Y coordinates relative to the body content. The point must be in client coordinates

GetColCount ( IHTMLTable table, int rowindex ) : int

Gets the column count of row(rowindex) Accounts for colSpan property

GetColIndex ( IHTMLTableCell cell ) : int

Get the column of the current cell zero based

GetDocumentColor ( DocumentColors whichcolor ) : System.Drawing.Color
GetParentRow ( IHTMLElement cellelem ) : IHTMLTableRow

Returns parent row of passed cell element

GetParentTable ( IHTMLElement cellelem ) : IHTMLTable

Returns parent table of passed cell element

GetPosFromCharIndex ( int charindex ) : tagPOINT

Attempts to retreive a character position relative to the body content based on the character index.

GetRow ( IHTMLTable table, int rowindex ) : IHTMLTableRow

Zero based

GetRowCount ( IHTMLTable table ) : int
GetRowIndex ( IHTMLElement cellelem ) : int
GetWordUnderMouse ( int clientX, int clientY ) : string

Attempts to retrive a word located under mouse pointer relative to body content

HTMLEditHelper ( ) : System
InsertCol ( IHTMLTable table, int index ) : void
InsertHTML ( IHTMLElement elem, string s_Html, bool b_AtBegin, bool b_Inside ) : void

Inserts the given HTML code inside or outside of this Html element There are 4 possible insert positions: Outside-BeforeInside-Before InnerHTML Inside-AfterOuside-After

InsertRow ( IHTMLTable table, int index, int numberofcells ) : void
IsElementEmpty ( IHTMLElement elem ) : bool

Return TRUE if the element is empty inside (e.g. )

NextSibiling ( IHTMLDOMNode node ) : IHTMLElement

Returns the right neighbour which is a IHTMLElement in the HTML hierarchy

PasteIntoSelection ( string s_Html ) : bool

The currently selected text/controls will be replaced by the given HTML code. If nothing is selected, the HTML code is inserted at the cursor position

PreviousSibling ( IHTMLDOMNode node ) : IHTMLElement

Returns the left neighbour which is a IHTMLElement in the HTML hierarchy

RemoveNode ( IHTMLElement elem, bool RemoveAllChildren ) : IHTMLDOMNode

Removes node element If RemoveAllChildren == true, Removes this element and all it's children from the document else it just strips this element but does not remove its children E.g. "Hello World" ---> strip BIG tag --> "Hello World"

RemoveUnderline ( IHTMLElement elem, IHighlightSegment ihs ) : void
Row_DeleteCol ( IHTMLTableRow row, int index ) : void
Row_GetCell ( IHTMLTableRow row, int index ) : IHTMLTableCell
Row_GetCellCount ( IHTMLTableRow row ) : int
Row_InsertCell ( IHTMLTableRow row, int index ) : IHTMLElement
Row_InsertCell ( IHTMLTableRow row, int index, string cellwidth ) : IHTMLElement
Row_InsertCol ( IHTMLTableRow row, int index ) : IHTMLElement
SetCursorAtElementStart ( IHTMLElement elem ) : bool

Attempts to set the cursor at the start of the given html element The element must be a textual element such as P

SetSelectionTextFromClipboard ( ) : bool

Attempts to set the selection text from clipboard

UnderLineWord ( int wordindex, int wordlen ) : void

Attempts to find and highlight a word based on it's index and wordlen within body element

UnderLineWord2 ( IHTMLTxtRange range ) : IHighlightSegment
Underline ( IHTMLElement elem ) : void

Attempts to underline a given element To change the highlighting style, please refer to HTMLRenderStyle_xxxxxxx properties

Underline2 ( IHTMLElement elem ) : IHighlightSegment

Underline variation which returns IHighlightSegmentinstance

Приватные методы

Метод Описание
CalculateCellWidths ( int numberofcols ) : void

Описание методов

AddToSelection() публичный Метод

1) If nothing is selected returns false 2) If the user has selected text or multiple elements inserts s_BeginHtml before and s_EndHtml behind the current selection 3)If the user has selected a control returns false
public AddToSelection ( string s_BeginHtml, string s_EndHtml ) : bool
s_BeginHtml string
s_EndHtml string
Результат bool

AppendAnchor() публичный Метод

public AppendAnchor ( string href, string target ) : bool
href string
target string
Результат bool

AppendChild() публичный Метод

Creates and appends an HTMLElement to a parent element
public AppendChild ( IHTMLElement parent, string TagName ) : IHTMLDOMNode
parent IHTMLElement
TagName string a, img, table,...
Результат IHTMLDOMNode

AppendChild() публичный Метод

Creates and appends an HTMLElement to the end of the document DOM
public AppendChild ( string TagName ) : IHTMLDOMNode
TagName string a, img, table,...
Результат IHTMLDOMNode

AppendHr() публичный Метод

public AppendHr ( string align, string hrcolor, string width, bool noshade ) : bool
align string
hrcolor string
width string
noshade bool
Результат bool

AppendImage() публичный Метод

public AppendImage ( string src, string width, string height, string border, string alignment, string alt, string hspace, string vspace, string lowsrc ) : bool
src string
width string
height string
border string
alignment string
alt string
hspace string
vspace string
lowsrc string
Результат bool

AppendTable() публичный Метод

public AppendTable ( int colnum, int rownum, int bordersize, string alignment, int cellpadding, int cellspacing, string widthpercentage, int widthpixel, string backcolor, string bordercolor, string lightbordercolor, string darkbordercolor ) : bool
colnum int
rownum int
bordersize int
alignment string
cellpadding int
cellspacing int
widthpercentage string
widthpixel int
backcolor string
bordercolor string
lightbordercolor string
darkbordercolor string
Результат bool

DeleteCol() публичный Метод

public DeleteCol ( IHTMLTable table, int colindex ) : void
table IHTMLTable
colindex int
Результат void

DeleteRow() публичный Метод

Deletes a given rowindex in a given table zero based If the table has no rows after deletion anymore we delete it compeletely
public DeleteRow ( IHTMLTable table, int rowindex ) : void
table IHTMLTable
rowindex int
Результат void

EmbedBr() публичный Метод

Embeds a BR tag at the selection
public EmbedBr ( ) : bool
Результат bool

FindParent() публичный Метод

Searches for a parent (or grandparent) element with the given tag ParentTagName must be in the form "TD" "TR" "TABLE" (uppercase)
public FindParent ( IHTMLElement elem, string ParentTagName ) : IHTMLElement
elem IHTMLElement
ParentTagName string
Результат IHTMLElement

GetCaretPosition() публичный Метод

Attempts to retreive Caret position
public GetCaretPosition ( ) : tagPOINT
Результат tagPOINT

GetCharIndexFromPos() публичный Метод

Attempts to retreive char index from given X and Y coordinates relative to the body content. The point must be in client coordinates
public GetCharIndexFromPos ( int clientX, int clientY ) : int
clientX int
clientY int
Результат int

GetColCount() публичный Метод

Gets the column count of row(rowindex) Accounts for colSpan property
public GetColCount ( IHTMLTable table, int rowindex ) : int
table IHTMLTable
rowindex int
Результат int

GetColIndex() публичный Метод

Get the column of the current cell zero based
public GetColIndex ( IHTMLTableCell cell ) : int
cell IHTMLTableCell
Результат int

GetDocumentColor() публичный Метод

public GetDocumentColor ( DocumentColors whichcolor ) : System.Drawing.Color
whichcolor DocumentColors
Результат System.Drawing.Color

GetParentRow() публичный Метод

Returns parent row of passed cell element
public GetParentRow ( IHTMLElement cellelem ) : IHTMLTableRow
cellelem IHTMLElement
Результат IHTMLTableRow

GetParentTable() публичный Метод

Returns parent table of passed cell element
public GetParentTable ( IHTMLElement cellelem ) : IHTMLTable
cellelem IHTMLElement
Результат IHTMLTable

GetPosFromCharIndex() публичный Метод

Attempts to retreive a character position relative to the body content based on the character index.
public GetPosFromCharIndex ( int charindex ) : tagPOINT
charindex int
Результат tagPOINT

GetRow() публичный Метод

Zero based
public GetRow ( IHTMLTable table, int rowindex ) : IHTMLTableRow
table IHTMLTable
rowindex int
Результат IHTMLTableRow

GetRowCount() публичный Метод

public GetRowCount ( IHTMLTable table ) : int
table IHTMLTable
Результат int

GetRowIndex() публичный Метод

public GetRowIndex ( IHTMLElement cellelem ) : int
cellelem IHTMLElement
Результат int

GetWordUnderMouse() публичный Метод

Attempts to retrive a word located under mouse pointer relative to body content
public GetWordUnderMouse ( int clientX, int clientY ) : string
clientX int Left cocordinates based relative to client
clientY int Top cocordinates based relative to client
Результат string

HTMLEditHelper() публичный Метод

public HTMLEditHelper ( ) : System
Результат System

InsertCol() публичный Метод

public InsertCol ( IHTMLTable table, int index ) : void
table IHTMLTable
index int
Результат void

InsertHTML() публичный Метод

Inserts the given HTML code inside or outside of this Html element There are 4 possible insert positions: Outside-BeforeInside-Before InnerHTML Inside-AfterOuside-After
public InsertHTML ( IHTMLElement elem, string s_Html, bool b_AtBegin, bool b_Inside ) : void
elem IHTMLElement
s_Html string
b_AtBegin bool
b_Inside bool
Результат void

InsertRow() публичный Метод

public InsertRow ( IHTMLTable table, int index, int numberofcells ) : void
table IHTMLTable
index int
numberofcells int
Результат void

IsElementEmpty() публичный Метод

Return TRUE if the element is empty inside (e.g. )
public IsElementEmpty ( IHTMLElement elem ) : bool
elem IHTMLElement
Результат bool

NextSibiling() публичный Метод

Returns the right neighbour which is a IHTMLElement in the HTML hierarchy
public NextSibiling ( IHTMLDOMNode node ) : IHTMLElement
node IHTMLDOMNode
Результат IHTMLElement

PasteIntoSelection() публичный Метод

The currently selected text/controls will be replaced by the given HTML code. If nothing is selected, the HTML code is inserted at the cursor position
public PasteIntoSelection ( string s_Html ) : bool
s_Html string
Результат bool

PreviousSibling() публичный Метод

Returns the left neighbour which is a IHTMLElement in the HTML hierarchy
public PreviousSibling ( IHTMLDOMNode node ) : IHTMLElement
node IHTMLDOMNode
Результат IHTMLElement

RemoveNode() публичный Метод

Removes node element If RemoveAllChildren == true, Removes this element and all it's children from the document else it just strips this element but does not remove its children E.g. "Hello World" ---> strip BIG tag --> "Hello World"
public RemoveNode ( IHTMLElement elem, bool RemoveAllChildren ) : IHTMLDOMNode
elem IHTMLElement
RemoveAllChildren bool
Результат IHTMLDOMNode

RemoveUnderline() публичный Метод

public RemoveUnderline ( IHTMLElement elem, IHighlightSegment ihs ) : void
elem IHTMLElement
ihs IHighlightSegment
Результат void

Row_DeleteCol() публичный Метод

public Row_DeleteCol ( IHTMLTableRow row, int index ) : void
row IHTMLTableRow
index int
Результат void

Row_GetCell() публичный Метод

public Row_GetCell ( IHTMLTableRow row, int index ) : IHTMLTableCell
row IHTMLTableRow
index int
Результат IHTMLTableCell

Row_GetCellCount() публичный Метод

public Row_GetCellCount ( IHTMLTableRow row ) : int
row IHTMLTableRow
Результат int

Row_InsertCell() публичный Метод

public Row_InsertCell ( IHTMLTableRow row, int index ) : IHTMLElement
row IHTMLTableRow
index int
Результат IHTMLElement

Row_InsertCell() публичный Метод

public Row_InsertCell ( IHTMLTableRow row, int index, string cellwidth ) : IHTMLElement
row IHTMLTableRow
index int
cellwidth string
Результат IHTMLElement

Row_InsertCol() публичный Метод

public Row_InsertCol ( IHTMLTableRow row, int index ) : IHTMLElement
row IHTMLTableRow
index int
Результат IHTMLElement

SetCursorAtElementStart() публичный Метод

Attempts to set the cursor at the start of the given html element The element must be a textual element such as P
public SetCursorAtElementStart ( IHTMLElement elem ) : bool
elem IHTMLElement
Результат bool

SetSelectionTextFromClipboard() публичный Метод

Attempts to set the selection text from clipboard
public SetSelectionTextFromClipboard ( ) : bool
Результат bool

UnderLineWord() публичный Метод

Attempts to find and highlight a word based on it's index and wordlen within body element
public UnderLineWord ( int wordindex, int wordlen ) : void
wordindex int
wordlen int
Результат void

UnderLineWord2() публичный Метод

public UnderLineWord2 ( IHTMLTxtRange range ) : IHighlightSegment
range IHTMLTxtRange
Результат IHighlightSegment

Underline() публичный Метод

Attempts to underline a given element To change the highlighting style, please refer to HTMLRenderStyle_xxxxxxx properties
public Underline ( IHTMLElement elem ) : void
elem IHTMLElement
Результат void

Underline2() публичный Метод

Underline variation which returns IHighlightSegmentinstance
public Underline2 ( IHTMLElement elem ) : IHighlightSegment
elem IHTMLElement
Результат IHighlightSegment

Описание свойств

HtmlAmp публичное свойство

public string HtmlAmp
Результат string

HtmlSpace публичное свойство

public string HtmlSpace
Результат string

HtmlTagClose публичное свойство

public string HtmlTagClose
Результат string

HtmlTagOpen публичное свойство

public string HtmlTagOpen
Результат string