none
How make line same length with sentences using C#? RRS feed

  • Question

  • Hello.. I,m using C# for make letter automation using template dotx

    i use mail merge

     if (fieldName == "NameSender")
                        {
                            myMergeField.Select();
                            oWord.Selection.TypeText(txt_nama.Text);
                        }

    How make dot line same length with sentences?

    sample:

    ...............

    (John Doe)

    ......................

    (Angelina Jolie)








    • Edited by vastavista Sunday, September 25, 2016 3:38 AM
    Sunday, September 25, 2016 3:35 AM

Answers

  • You could output the name twice, the first time in, say, a white font with a dotted black underline, the second time as normal text. Just make sure both use the same font & point size.

    Note: What you're doing really isn't the way mergefields are meant to be used; they're meant for use with a mailmerge, which isn't what you're doing.


    Cheers
    Paul Edstein
    [MS MVP - Word]

    • Proposed as answer by David_JunFeng Friday, September 30, 2016 5:31 AM
    • Marked as answer by David_JunFeng Wednesday, October 5, 2016 1:38 PM
    Sunday, September 25, 2016 7:17 AM

All replies

  • You could output the name twice, the first time in, say, a white font with a dotted black underline, the second time as normal text. Just make sure both use the same font & point size.

    Note: What you're doing really isn't the way mergefields are meant to be used; they're meant for use with a mailmerge, which isn't what you're doing.


    Cheers
    Paul Edstein
    [MS MVP - Word]

    • Proposed as answer by David_JunFeng Friday, September 30, 2016 5:31 AM
    • Marked as answer by David_JunFeng Wednesday, October 5, 2016 1:38 PM
    Sunday, September 25, 2016 7:17 AM
  • Hi vastavista,

    According to your description, I have made a sample and verify macropod's solution, you could follow macropod's solution.

    In addition if you want to use code to achieve this requirement, I suggest that you could use Record Macro to get VBA code, then convert them into C#.

    Thanks for your understanding.
    Monday, September 26, 2016 9:30 AM