Hi I'm looking for any idea to make something like that:
Some Text---------------------------------------------------
This "------" I have to make on button click to the end of line.
My idea was to make it on tabstop with dashed leader, but it make problem because when im trying to use ^t inside text after this it makes dashes also. It can't be done just by typing dashes because second button would be to clear that dashing from whole document.
This is code that I make but like I said it is not good because that ^t at any other place of document is terrible
public void DashingSingleLane()
{
Word.Range rng = Globals.ThisAddIn.Application.Selection.Range;
if (rng.Start == rng.End)
{
float pageWidth = classDocument.PageSetup.PageWidth - classDocument.PageSetup.LeftMargin - classDocument.PageSetup.RightMargin;
foreach (Word.Paragraph singleParagraph in rng.Paragraphs)
{
if ((singleParagraph.Range.Text != "\r") && (singleParagraph.Range.Text.IndexOf("\t") == -1))
{
singleParagraph.TabStops.Add(pageWidth, Word.WdTabAlignment.wdAlignTabRight, Word.WdTabLeader.wdTabLeaderDashes);
Globals.ThisAddIn.Application.Selection.EndKey(Microsoft.Office.Interop.Word.WdUnits.wdLine);
Globals.ThisAddIn.Application.Selection.TypeText("\t");
}
}
}
}
I found that to make it good I need also to put Tabstop with left align exacly at the end of sentence. Something like that
singleParagraph.TabStops.AddPosition_in_Point, Word.WdTabAlignment.wdAlignTabLeft, Word.WdTabLeader.wdTabLeaderDashes);
But I don't know how to get that position in point
I'm thinking about that problem from 2 days and I don't have any good idea. I hope somebody would have some good think.