Delphi 2010:Multiline content in Word Table

I'm automating some document creation using Delphi 2010.

In the layout I have, I need to insert one line of text into a Word table cell (1, 1), then move to the next line, change the paragraph settings, and insert a horizontal rule

I can setup the table and the first line content, but cannot for the life of me work out how to move the cursor to the second line of the cell, or insert the horizontal line

What I have so far:

   tbl.Cell(1, 1).Range.Text := s;
   with tbl.Cell(1, 1).Range do
   begin
      Font.Name := '+Headings';
      Font.Size := 14;
      Font.Bold := -1;
      Font.AllCaps := -1;
      ParagraphFormat.LineSpacingRule := wdLineSpaceAtLeast;
      ParagraphFormat.LineSpacing := 12;
      ParagraphFormat.SpaceAfter := 0;
      ParagraphFormat.SpaceBefore := 0;
   end;
   tbl.Cell(1, 1).Range.InsertParagraphAfter;

I cannot even create a macro for the Horizontal line (which needs to be and exact size and weight) as VBA in Word 2010 won't record from right-clicks...

Answers


So the code I needed to do the new line was as follows

seltype := wdLine;
lineextend := False;
WordApp.Selection.EndKey(seltype, lineextend);
WordApp.Selection.TypeParagraph;

Which sends an "End" signal to Word.

As for recording the new Horizontal Line, I found that in some situations the Context Menu Key on a Windows Keyboard still works when recording macros, where Right Click does not.


Need Your Help

from python 32 bits to python 64 bits

python 64bit 32-bit anaconda pythonxy

I have some doubts about how to do that, I hope anybody can point me in the correct direction.

Add field for each file in fine-uploader

custom-fields fine-uploader

Trying to implement Fine-Uploader for first time.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.