guys,
im trying to get bulleting to work. I've yet to see what's the output for this one, can someone help me out?
It kept saying incompatible types between listtemplate, listlevel against variant types. But from all the examples i see on the net, the word document object is a variant! Is there any way to get it working? because i'd like to see the output of this code! :(
procedure TForm3.Button1Click(Sender: TObject);
var
vListTemplate: ListTemplate;
vLevel: OleVariant;
OutlineNum: OleVariant;
Level: ListLevel;
ContinuePrev: OleVariant;
var
wrdApp, wrdDoc, wrdSelect : OleVariant;
begin
// Create an instance of Word and make it visible
wrdApp := CreateOleObject('Word.Application');
wrdApp.Visible := True;
// Create a new document
wrdDoc := wrdApp.Documents.Add();
wrdSelect := wrdApp.Selection;
//
wrdSelect.TypeText('(i) phase 1' + chr(13));
wrdSelect.TypeText(' - description, description, description.' + chr(13));
wrdSelect.TypeText(' - description, description, description,');
wrdSelect.TypeText('description, description, description.' + chr(13));
wrdSelect.TypeText('(ii) phase 2' + chr(13));
wrdSelect.TypeText(' - description, description, description,');
wrdSelect.TypeText('description, description, description,');
wrdSelect.TypeText('description, description, description.' + chr(13));
//
wrdDoc.Application.ActiveDocument.Select;
OutLineNum := True;
vListTemplate := wrdDoc.ListTemplates.Add(OutLineNum, EmptyParam);
Level := vListTemplate.ListLevels.Item(1);
Level.NumberFormat := '?'; //ChrW(61607);
Level.TrailingCharacter := wdTrailingTab;
Level.NumberStyle := wdListNumberStyleBullet;
Level.Alignment := wdListLevelAlignLeft;
Level.Font.Bold := wdUndefined;
Level.Font.Italic := wdUndefined;
Level.Font.StrikeThrough := wdUndefined;
Level.Font.Subscript := wdUndefined;
Level.Font.Superscript := wdUndefined;
Level.Font.Shadow := wdUndefined;
Level.Font.Outline := wdUndefined;
Level.Font.Emboss := wdUndefined;
Level.Font.Engrave := wdUndefined;
Level.Font.AllCaps := wdUndefined;
Level.Font.Hidden := wdUndefined;
Level.Font.Underline := wdUndefined;
Level.Font.ColorIndex := wdUndefined;
Level.Font.Size := 10;
Level.Font.Animation := wdUndefined;
Level.Font.DoubleStrikeThrough := wdUndefined;
Level.Font.Name := 'Wingdings';
Level.LinkedStyle := '';
ContinuePrev := False;
wrdDoc.Range.ListFormat.ApplyListTemplate(vListTemplate,
ContinuePrev, EmptyParam); //wdListApplyToWholeList);
end;