Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. dynamically writing text into word document using vb.net

dynamically writing text into word document using vb.net

Scheduled Pinned Locked Moved Visual Basic
csharphelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vijaylumar
    wrote on last edited by
    #1

    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 ...

    P 1 Reply Last reply
    0
    • V vijaylumar

      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 ...

      P Offline
      P Offline
      Paramu1973
      wrote on last edited by
      #2

      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:

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups