How can I add an custom annotation in the Header and footer ? Is there a way to do it ?
Document.CaretPosition doesnt get the Header position. I dont find any move functions to move in to the Header as well ?.
I added custom annotation on the document as below :
Document.InsertCustomAnnotationRange(position, position, new RangeStart(id), new RangeEnd());
Didn't find any functions to add custom annotations in the Header or move in to the Header ? Could you help me in this please ?
Thanks
Anand
Document.CaretPosition doesnt get the Header position. I dont find any move functions to move in to the Header as well ?.
I added custom annotation on the document as below :
Document.InsertCustomAnnotationRange(position, position, new RangeStart(id), new RangeEnd());
Didn't find any functions to add custom annotations in the Header or move in to the Header ? Could you help me in this please ?
Thanks
Anand
5 Answers, 1 is accepted
0
Anand
Top achievements
Rank 1
answered on 07 Aug 2014, 09:39 AM
Hi All,
I worked out my way to get the Headers and footers as below.Document.section[0].Headers.Default.Body
But weirdly, in Header, I found always the cursor position points to the starting first word of the Header. It doesnt seems to get updated even when I move the cursor around.
I get the cursor by Document.section[0].Headers.First.Body.CaretPosition
Not sure am I missing something ?
I worked out my way to get the Headers and footers as below.Document.section[0].Headers.Default.Body
But weirdly, in Header, I found always the cursor position points to the starting first word of the Header. It doesnt seems to get updated even when I move the cursor around.
I get the cursor by Document.section[0].Headers.First.Body.CaretPosition
Not sure am I missing something ?
0
Hello Anand,
When you work with headers, footers or comments you need to use the ActiveDocumentEditor of RadRichTextBox in order to manipulate the correct part of the document.
Here is how you can get the correct caret position:
I would also suggest you to use the InsertAnnotationRange of ActiveDocumentEditor, which will insert the start and end annotations in the start and end position of the selection of ActiveDocumentEditor.Document. Here is example on how to do it:
I hope this information answer your question. In case you have additional questions feel free to contact us again.
Regards,
Mihail
Telerik
When you work with headers, footers or comments you need to use the ActiveDocumentEditor of RadRichTextBox in order to manipulate the correct part of the document.
Here is how you can get the correct caret position:
DocumentPosition carretPosition =
this
.radRichTextBox.ActiveDocumentEditor.Document.CaretPosition;
I would also suggest you to use the InsertAnnotationRange of ActiveDocumentEditor, which will insert the start and end annotations in the start and end position of the selection of ActiveDocumentEditor.Document. Here is example on how to do it:
this
.radRichTextBox.FocusHeader();
this
.radRichTextBox.ActiveDocumentEditor.Document.Selection.AddSelectionStart(startPosition);
this
.radRichTextBox.ActiveDocumentEditor.Document.Selection.AddSelectionEnd(endPosition);
this
.radRichTextBox.ActiveDocumentEditor.InsertAnnotationRange(annotationStart, annotationEnd);
this
.radRichTextBox.ActiveDocumentEditor.Document.Selection.Clear();
I hope this information answer your question. In case you have additional questions feel free to contact us again.
Regards,
Mihail
Telerik
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
0
Anand
Top achievements
Rank 1
answered on 13 Aug 2014, 01:20 PM
Hi Mihail,
Thanks for the reply. Yes , this way I could get the current cursor position in the document ,across the Headers and Footers.
But I couldn't work out a way whether the active document (this.radRichTextBox.ActiveDocumentEditor.Document) is the Header or Footer ?
I am in a scenario, where I dont want to do few operations when I am on footer. Could you help me in finding the active document that I am in is a Header or Footer ?
Thanks
Anand
Thanks for the reply. Yes , this way I could get the current cursor position in the document ,across the Headers and Footers.
But I couldn't work out a way whether the active document (this.radRichTextBox.ActiveDocumentEditor.Document) is the Header or Footer ?
I am in a scenario, where I dont want to do few operations when I am on footer. Could you help me in finding the active document that I am in is a Header or Footer ?
Thanks
Anand
0
Hello Anand,
In order to determine what will be edited with the ActiveDocumentEditor you could subscribe to the RadRichTextBox.ActiveDocumentEditorChanged event. The argument of this event ActiveDocumentEditorChangedEventArgs contains the property DocumentEditorType, which specifies the part of the edited document: Header, Footer, Comment etc.
Here is example:
I hope this information answer your question.
Regards,
Mihail
Telerik
In order to determine what will be edited with the ActiveDocumentEditor you could subscribe to the RadRichTextBox.ActiveDocumentEditorChanged event. The argument of this event ActiveDocumentEditorChangedEventArgs contains the property DocumentEditorType, which specifies the part of the edited document: Header, Footer, Comment etc.
Here is example:
private
void
RadRichTextBox_ActiveDocumentEditorChanged(
object
sender, ActiveDocumentEditorChangedEventArgs e)
{
if
(e.DocumentEditorType == DocumentEditorType.Header)
{
MessageBox.Show(
"In Header"
);
}
else
if
(e.DocumentEditorType == DocumentEditorType.Footer)
{
MessageBox.Show(
"In Footer"
);
}
}
I hope this information answer your question.
Regards,
Mihail
Telerik
Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
0
Anand
Top achievements
Rank 1
answered on 19 Aug 2014, 08:32 AM
Hi Mihail,
Thanks for the reply. That works fine and I found another way of getting it.
var presenter = (IDocumentEditorPresenterContainer)this.radRichTextBox;
presenter.HeaderFooterUIContext.IsHeaderFocused
Regards
A
Thanks for the reply. That works fine and I found another way of getting it.
var presenter = (IDocumentEditorPresenterContainer)this.radRichTextBox;
presenter.HeaderFooterUIContext.IsHeaderFocused
Regards
A