Estoy tratando de crear un documento de Word, pero este no visualiza de forma carecta si pongo caracteres acentuados o si le paso algún valor desde un campo de texto al documento.
Como podría solventar este error de conversión de tipos?
el código que utilizo es el siguiente:
procedure Tflconv.cmdlistClick(Sender: TObject);
var
libro: OLEVariant;
begin
try
libro := CreateOleObject('Word.Application');
except
on e:exception do begin
Application.MessageBox('Error al crear el documento. Primeramente debe instalar el Office.', pchar(Self.Caption), MB_ICONINFORMATION);
exit;
end;
end;
libro.WordBasic.FileNew;
libro.Selection.TypeText('ACTA DE CONCILIACIÓN DE PAGO');
libro.Selection.TypeParagraph;
libro.Selection.MoveUp(5, 1);
libro.ActiveWindow.ActivePane.LargeScroll(-1);
libro.Selection.EndKey(5, 1);
libro.Selection.ParagraphFormat.Alignment := 1;
libro.Selection.Font.Bold := 9999998;
libro.Selection.Font.Italic := 9999998;
libro.Selection.Font.Size := 16;
libro.Selection.MoveDown(5, 3);
libro.Selection.TypeParagraph;
libro.Selection.TypeText(Text:='DE UNA PARTE: ' + txtnombre.Text + ' con domicilio legal en ' + txtdir.Text + '. Registrada con el código No ' + txtent.Text);
libro.Selection.TypeParagraph;
libro.Visible:=true;
end;