dynamically writing text into word document using vb.net
-
hi i m generating a output report in MS word document. i middle of report few values are based on user input if user inputs quantity =2 then i want to display two paragraphs simialary if quantity=3 then i want to display 3 paragraphs can one help me ...
-
hi i m generating a output report in MS word document. i middle of report few values are based on user input if user inputs quantity =2 then i want to display two paragraphs simialary if quantity=3 then i want to display 3 paragraphs can one help me ...
MsWrdFile = New Microsoft.Office.Interop.Word.Application MsWrdFile = CreateObject("Word.Application") MsWrdFile.Documents.Add() MsDcmt = MsWrdFile.ActiveDocument Dim Rg1 As Microsoft.Office.Interop.Word.Range = MsWrdFile.ActiveDocument.Range(Start:=0, End:=0) MsWrdFile.ActiveDocument.Tables.Add(Rg1, 3, 4) MsWrdFile.ActiveDocument.Tables(1).Style = "Table Grid 8" For I As Integer = 0 To 2 Dim oPara_i As Microsoft.Office.Interop.Word.Paragraph oPara_i = MsWrdFile.ActiveDocument.Content.Paragraphs.Add If I = 0 Then oPara_i.Range.Text = "Heading 0" ElseIf I = 1 Then oPara_i.Range.Text = "Heading 1" ElseIf I = 2 Then oPara_i.Range.Text = "Heading 2" End If oPara_i.Range.Font.Bold = True oPara_i.Format.SpaceAfter = 24 '24 pt spacing after paragraph. oPara_i.Range.InsertParagraphAfter() Next MsWrdFile.Visible = True MsWrdFile.Quit() :thumbsup: