Hi,
I am loading custom styles of active document in comboBox of MyRibbon of Word 2007.
When I am changes the style from style comboBox of MyRibbon, if any word or range is selected then style applies to only that portion.
But if there is not selection, style is applied to entire row. It should behave like word, only current cursor range style should change and when one start writing then it should be of applied style.
Code Snip
<comboBox id="cboChooseItem" getItemCount="cboGetItemCount"
getItemID ="cboGetItemID"
getItemLabel ="cboGetItemLabel"
onChange ="OnChangeCmbStyle"/>
public string OnChangeCmbStyle(Office.IRibbonControl control, string index)
{
object style = index;
if (control.Id == "cboChooseItem")
{
ObjActiveDocument = Globals.ThisAddIn.Application.ActiveDocument;
ObjActiveDocument.Application.ScreenUpdating = false;
ObjActiveDocument.Application.Selection.SetRange(ObjActiveDocument.Application.Selection.Start,ObjActiveDocument.Application.Selection.End);
ObjActiveDocument.Application.Selection.set_Style(ref style);
ObjActiveDocument.Application.ScreenUpdating = true;
}
return index;
}
Thanks in Advance.