I have this form that when it is submitted is convert to a MS Word doc. That works fine on the server but when I tried it in the mobile app, it doesn't work. The page looks like it is just refreshed. The way it works is that the user clicks on a link on
in the mobile app and goes to this mobile (looking) web page on the server. Fills out the form and clicks submit to make the Word doc. Also, all the styling is using JQuery Mobile.
Any help would be greatly appreciated. I cannot afford MonoTouch since I have limited funds.
Imports System
Imports System.Data
Imports System.Configuration
Imports System.Web
Imports System.Web.Security
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts
Imports System.Web.UI.HtmlControls
Imports System.Text
Partial Class pdfEval
Inherits System.Web.UI.Page
Protected Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click
Dim strBody As New System.Text.StringBuilder("")
Dim strItem As String = ""
strBody.Append("<html " & _
"xmlns:o='urn:schemas-microsoft-com:office:office' " & _
"xmlns:w='urn:schemas-microsoft-com:office:word'" & _
"xmlns='http://www.w3.org/TR/REC-html40'>" & _
"<head><title>Time</title>")
'The setting specifies document's view after it is downloaded as Print
'instead of the default Web Layout
strBody.Append("<!--[if gte mso 9]>" & _
"<xml>" & _
"<w:WordDocument>" & _
"<w:View>Print</w:View>" & _
"<w:Zoom>90</w:Zoom>" & _
"<w:DoNotOptimizeForBrowser/>" & _
"</w:WordDocument>" & _
"</xml>" & _
"<![endif]-->")
strBody.Append("<style>" & _
"<!-- /* Style Definitions */" & _
"@page Section1" & _
" {size:8.5in 11.0in; " & _
" margin:1.0in 1.25in 1.0in 1.25in ; " & _
" mso-header-margin:.5in; " & _
" mso-footer-margin:.5in; mso-paper-source:0;}" & _
" div.Section1" & _
" {page:Section1;}" & _
"-->" & _
"</style></head>")
strBody.Append("<body lang=EN-US style='tab-interval:.5in'>" & _
"<div class=Section1>" & _
"<h1>PDF Questionaire</h1>")
strBody.Append("<br>" & "Document Name: _____________________________________________<br>")
strBody.Append("<br>" & "Date: ______________________________ <br>")
strBody.Append("<br>" & "Checker Name: ________________________________________ <br>")
strBody.Append("<br>" & "<h2>Documents</h2>")
strBody.Append("<table width='100%' cellspacing='0' cellpadding='2' border='1'")
strBody.Append("<tr>")
strBody.Append("<td align='center'>Requirement</td>")
strBody.Append("<td>Evaluation</td>")
strBody.Append("</tr>")
strBody.Append("<tr>")
strBody.Append("<td>The document is not scanned and does not contained scanned content.</td>")
'start looping for answers to questions
If RadioButtonList1.Items(0).Selected Then
strItem = RadioButtonList1.Items(0).Text
ElseIf RadioButtonList1.Items(1).Selected Then
strItem = RadioButtonList1.Items(1).Text
Else
strItem = RadioButtonList1.Items(2).Text
End If
strBody.Append("<td>" & strItem & "</td>")
strBody.Append("</tr>")
strBody.Append("</table>")
strBody.Append("</div></body></html>")
'Force this content to be downloaded
'as a Word document with the name of your choice
Response.AppendHeader("Content-Type", "application/msword")
Response.AppendHeader("Content-disposition", _
"attachment; filename=myword.doc")
Response.Write(strBody)
End Sub
End Class
gmcghee
Participant
929 Points
251 Posts
Convert form data to MS Word (Mobile)
Jan 04, 2013 02:29 PM|LINK
I have this form that when it is submitted is convert to a MS Word doc. That works fine on the server but when I tried it in the mobile app, it doesn't work. The page looks like it is just refreshed. The way it works is that the user clicks on a link on in the mobile app and goes to this mobile (looking) web page on the server. Fills out the form and clicks submit to make the Word doc. Also, all the styling is using JQuery Mobile.
Any help would be greatly appreciated. I cannot afford MonoTouch since I have limited funds.
Imports System Imports System.Data Imports System.Configuration Imports System.Web Imports System.Web.Security Imports System.Web.UI Imports System.Web.UI.WebControls Imports System.Web.UI.WebControls.WebParts Imports System.Web.UI.HtmlControls Imports System.Text Partial Class pdfEval Inherits System.Web.UI.Page Protected Sub Button1_Click(sender As Object, e As System.EventArgs) Handles Button1.Click Dim strBody As New System.Text.StringBuilder("") Dim strItem As String = "" strBody.Append("<html " & _ "xmlns:o='urn:schemas-microsoft-com:office:office' " & _ "xmlns:w='urn:schemas-microsoft-com:office:word'" & _ "xmlns='http://www.w3.org/TR/REC-html40'>" & _ "<head><title>Time</title>") 'The setting specifies document's view after it is downloaded as Print 'instead of the default Web Layout strBody.Append("<!--[if gte mso 9]>" & _ "<xml>" & _ "<w:WordDocument>" & _ "<w:View>Print</w:View>" & _ "<w:Zoom>90</w:Zoom>" & _ "<w:DoNotOptimizeForBrowser/>" & _ "</w:WordDocument>" & _ "</xml>" & _ "<![endif]-->") strBody.Append("<style>" & _ "<!-- /* Style Definitions */" & _ "@page Section1" & _ " {size:8.5in 11.0in; " & _ " margin:1.0in 1.25in 1.0in 1.25in ; " & _ " mso-header-margin:.5in; " & _ " mso-footer-margin:.5in; mso-paper-source:0;}" & _ " div.Section1" & _ " {page:Section1;}" & _ "-->" & _ "</style></head>") strBody.Append("<body lang=EN-US style='tab-interval:.5in'>" & _ "<div class=Section1>" & _ "<h1>PDF Questionaire</h1>") strBody.Append("<br>" & "Document Name: _____________________________________________<br>") strBody.Append("<br>" & "Date: ______________________________ <br>") strBody.Append("<br>" & "Checker Name: ________________________________________ <br>") strBody.Append("<br>" & "<h2>Documents</h2>") strBody.Append("<table width='100%' cellspacing='0' cellpadding='2' border='1'") strBody.Append("<tr>") strBody.Append("<td align='center'>Requirement</td>") strBody.Append("<td>Evaluation</td>") strBody.Append("</tr>") strBody.Append("<tr>") strBody.Append("<td>The document is not scanned and does not contained scanned content.</td>") 'start looping for answers to questions If RadioButtonList1.Items(0).Selected Then strItem = RadioButtonList1.Items(0).Text ElseIf RadioButtonList1.Items(1).Selected Then strItem = RadioButtonList1.Items(1).Text Else strItem = RadioButtonList1.Items(2).Text End If strBody.Append("<td>" & strItem & "</td>") strBody.Append("</tr>") strBody.Append("</table>") strBody.Append("</div></body></html>") 'Force this content to be downloaded 'as a Word document with the name of your choice Response.AppendHeader("Content-Type", "application/msword") Response.AppendHeader("Content-disposition", _ "attachment; filename=myword.doc") Response.Write(strBody) End Sub End Classroopeshreddy
All-Star
20155 Points
3328 Posts
Re: Convert form data to MS Word (Mobile)
Jan 05, 2013 12:33 AM|LINK
Hi,
On which mobile device browser you have checked this?
Instead of Microsoft Word Content Type, try generic - application/octet-stream
Response.AppendHeader("Content-Type", "application/octet-stream")Hope it helps u...
Roopesh Reddy C
Roopesh's Space