word document in web application
-
hi all, i'm developin a web application in vb.net 2005 in which i need certain values to be passed to a word document....but i'm unable to do so....can anyone here help me... Any help will be very kind of you Thanks..
-
hi all, i'm developin a web application in vb.net 2005 in which i need certain values to be passed to a word document....but i'm unable to do so....can anyone here help me... Any help will be very kind of you Thanks..
this is the function I am using by passing datatable and filename Private Sub SaveDataToMSWord(ByVal dt As DataTable, ByVal FileName As String) Try Dim oldCI As System.Globalization.CultureInfo = _ System.Threading.Thread.CurrentThread.CurrentCulture System.Threading.Thread.CurrentThread.CurrentCulture = _ New System.Globalization.CultureInfo("en-US") Dim wapp As Word.Application Dim wdoc As Word.Document ' Dim strDbFullPath As String Dim strText As String wapp = New Word.Application wapp.Visible = True wdoc = wapp.Documents.Add Dim Count As Integer = 0 For Count = 0 To dt.Rows.Count - 1 Dim strDesignation As String = dt.Rows(Count).Item("ConJobTitleManual") If strDesignation = "" Then strDesignation = dt.Rows(Count).Item("Others") End If strText = dt.Rows(Count).Item("cpyName") With (wapp.Selection) .Font.Size = 14 .Font.Color = Word.WdColor.wdColorBlack .Font.Bold = True .TypeText(strText) .InsertBreak(Type:=Word.WdBreakType.wdLineBreak) .Font.Size = 9 .Font.Bold = False .TypeText(dt.Rows(Count).Item("cpyAddress1") & "," & dt.Rows(Count).Item("cpyTown") & "," & dt.Rows(Count).Item("cpyCounty") & "," & dt.Rows(Count).Item("cpyPostCode")) .InsertBreak(Type:=Word.WdBreakType.wdLineBreak) .TypeText(dt.Rows(Count).Item("cpyCountry")) .InsertBreak(Type:=Word.WdBreakType.wdLineBreak) If dt.Rows(Count).Item("cpySIC1") <> 0 Then .TypeText("SIC:" & dt.Rows(Count).Item("cpySIC1")) If dt.Rows(Count).Item("cpySIC2") <> 0 Then .TypeText("," & dt.Rows(Count).Item("cpySIC2")) End If End If .InsertBreak(Type:=Word.WdBreakType.wdLineBreak) .TypeText(dt.Rows(Count).Item("cpyURL")) .InsertBreak(Type:=Word.WdBreakType.wdLineBreak) .TypeText("Tel:" & dt.Rows(Count).Item("ConTelMain")) .InsertBreak(Type:=Word.WdBreakType.wdLineBreak) End With
-
this is the function I am using by passing datatable and filename Private Sub SaveDataToMSWord(ByVal dt As DataTable, ByVal FileName As String) Try Dim oldCI As System.Globalization.CultureInfo = _ System.Threading.Thread.CurrentThread.CurrentCulture System.Threading.Thread.CurrentThread.CurrentCulture = _ New System.Globalization.CultureInfo("en-US") Dim wapp As Word.Application Dim wdoc As Word.Document ' Dim strDbFullPath As String Dim strText As String wapp = New Word.Application wapp.Visible = True wdoc = wapp.Documents.Add Dim Count As Integer = 0 For Count = 0 To dt.Rows.Count - 1 Dim strDesignation As String = dt.Rows(Count).Item("ConJobTitleManual") If strDesignation = "" Then strDesignation = dt.Rows(Count).Item("Others") End If strText = dt.Rows(Count).Item("cpyName") With (wapp.Selection) .Font.Size = 14 .Font.Color = Word.WdColor.wdColorBlack .Font.Bold = True .TypeText(strText) .InsertBreak(Type:=Word.WdBreakType.wdLineBreak) .Font.Size = 9 .Font.Bold = False .TypeText(dt.Rows(Count).Item("cpyAddress1") & "," & dt.Rows(Count).Item("cpyTown") & "," & dt.Rows(Count).Item("cpyCounty") & "," & dt.Rows(Count).Item("cpyPostCode")) .InsertBreak(Type:=Word.WdBreakType.wdLineBreak) .TypeText(dt.Rows(Count).Item("cpyCountry")) .InsertBreak(Type:=Word.WdBreakType.wdLineBreak) If dt.Rows(Count).Item("cpySIC1") <> 0 Then .TypeText("SIC:" & dt.Rows(Count).Item("cpySIC1")) If dt.Rows(Count).Item("cpySIC2") <> 0 Then .TypeText("," & dt.Rows(Count).Item("cpySIC2")) End If End If .InsertBreak(Type:=Word.WdBreakType.wdLineBreak) .TypeText(dt.Rows(Count).Item("cpyURL")) .InsertBreak(Type:=Word.WdBreakType.wdLineBreak) .TypeText("Tel:" & dt.Rows(Count).Item("ConTelMain")) .InsertBreak(Type:=Word.WdBreakType.wdLineBreak) End With
Thanx rizwan for your help.....but this code works in windows application not in web application...anyways i got a way to get it in web application, but now i have another problem, i have a datagrid in the same application now i want to get that data grid in the word document....can you help me on this..... thanks a lot rizwan manik
-
Thanx rizwan for your help.....but this code works in windows application not in web application...anyways i got a way to get it in web application, but now i have another problem, i have a datagrid in the same application now i want to get that data grid in the word document....can you help me on this..... thanks a lot rizwan manik
Hi Friend, i need a small help I want to displya the word document on the web form with out changing the formate ie ., i need some control with in which i can display the word document in the server Thanks in Advance
-
hi all, i'm developin a web application in vb.net 2005 in which i need certain values to be passed to a word document....but i'm unable to do so....can anyone here help me... Any help will be very kind of you Thanks..