需要签名行与打印名称出现在同一行打开 xml sdk 2.5 - 根据 Tab 位置输入文本

Need signature line to appear on same line as printed name open xml sdk 2.5 - Enter Text Based on Tab position

我想知道是否有人可以帮助解决这个问题。我已经使用 Open XML SDK 2.5 生产力工具反映了 Word 文档的代码。但是,我在编辑代码以在与用户键入的名称相同的行上获取签名行时遇到问题。所以我想要这个:

Joe Blow          ______________________
Larry Star        ______________________

等我想要相同长度的签名行。

当然,我可以证明段落的合理性,但这不会使事情保持一致。我想做的是转到某个选项卡位置并画线,但我不确定该怎么做。

有人可以帮忙吗?

我想通了。下面是用于在特定选项卡位置添加文本的 open xml SDK C# 代码。希望对其他人有帮助。

 Paragraph paragraph52 = new Paragraph() { RsidParagraphAddition = "00736172", RsidRunAdditionDefault = "00736172", ParagraphId = "359EF518", TextId = "77777777" };

            ParagraphProperties paragraphProperties52 = new ParagraphProperties();

            Run run28 = new Run();
            Text text26 = new Text() { Space = SpaceProcessingModeValues.Preserve };

            if (oversight.Lead == null)
            {
                text26.Text = "";
            }
            else
            {
                text26.Text = "Joe Blow - Manager";
            }

            run28.Append(text26);

            Run run29 = new Run();
            TabChar tabChar1 = new TabChar();
            run29.Append(tabChar1);

            Tabs tabs2 = new Tabs();
            TabStop tabStop2 = new TabStop() { Val = TabStopValues.Left, Position = 5025 };
            tabs2.Append(tabStop2);
            paragraphProperties52.Append(tabs2);

            Run run30 = new Run();

            Text text27 = new Text(); 

            if (oversight.Lead == null)
            {
                text27.Text = "";
            }
            else
            {
                text27.Text = " ______________________________";
            }

            run30.Append(text27);

            paragraph52.Append(paragraphProperties52);
            paragraph52.Append(run28);
            paragraph52.Append(run29);
            paragraph52.Append(run30);

我想通了。下面是用于在特定选项卡位置添加文本的 open xml SDK C# 代码。希望对其他人有帮助。

 Paragraph paragraph52 = new Paragraph() { RsidParagraphAddition = "00736172", RsidRunAdditionDefault = "00736172", ParagraphId = "359EF518", TextId = "77777777" };

            ParagraphProperties paragraphProperties52 = new ParagraphProperties();

            Run run28 = new Run();
            Text text26 = new Text() { Space = SpaceProcessingModeValues.Preserve };

            if (oversight.Lead == null)
            {
                text26.Text = "";
            }
            else
            {
                text26.Text = "Joe Blow - Manager";
            }

            run28.Append(text26);

            Run run29 = new Run();
            TabChar tabChar1 = new TabChar();
            run29.Append(tabChar1);

            Tabs tabs2 = new Tabs();
            TabStop tabStop2 = new TabStop() { Val = TabStopValues.Left, Position = 5025 };
            tabs2.Append(tabStop2);
            paragraphProperties52.Append(tabs2);

            Run run30 = new Run();

            Text text27 = new Text(); 

            if (oversight.Lead == null)
            {
                text27.Text = "";
            }
            else
            {
                text27.Text = " ______________________________";
            }

            run30.Append(text27);

            paragraph52.Append(paragraphProperties52);
            paragraph52.Append(run28);
            paragraph52.Append(run29);
            paragraph52.Append(run30);

此外,不要忘记将段落附加到正文中:

 body1.Append(paragraph52);