Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Formatting output - Part 2

Reply
Thread Tools

Formatting output - Part 2

 
 
Tom Petersen
Guest
Posts: n/a
 
      04-01-2005
Here is a little more info, sorry should have explained what my final goal
was. I am creating a .vcs file from a form to import into Outlook. I was
just testing the output on screen then pasting that into a file, after
removing the extra white space, and inserting line breaks. The data is
valid, but the formatting into the file isn't working. Was I doing the
formatting right if I was generating a file? I need it to create the .vcs
without any white spaces and a 'return' after each line to match the output
at the very bottom. Here is the code again, and the bit to generate the
file:

strvCalendar = "BEGIN:VCALENDAR" & vbCrLf & _
"VERSION:1.0" & vbCrLf & _
"BEGIN:VEVENT" & vbCrLf & _
"DTSTART:" & strStart & vbCrLf & _
"DTEND:" & strStart & vbCrLf & _
"LOCATION;ENCODING=QUOTED-PRINTABLE:" & strLocation & vbCrLf & _
"UID:" & strStart & strSubject & vbCrLf & _
"DESCRIPTION;ENCODING=QUOTED-PRINTABLE:" & strDescription & vbCrLf & _
"SUMMARY;ENCODING=QUOTED-PRINTABLE:" & strSubject & vbCrLf & _
"PRIORITY:3" & vbCrLf & _
"END:VEVENT" & vbCrLf & _
"END:VCALENDAR" & vbCrLf

Response.ContentType = "text/x-vCalendar"
Response.AddHeader "Content-Disposition", _
"filename=Event" & "cal.vcs"
Response.Write strvCalendar
Response.End

This gernerates an error message in Outlook stating it can't import the
calendar file. But, again, if I paste the data into a text file with a .vcs
extension, and delete white space and insert line breaks I can double click
the file and it imports into Outlook fine, this is why I think I just don't
know how to format the 'output' correctly.

I appreciate the help!!!

Final .vcs contents:
BEGIN:VCALENDAR
VERSION:1.0
BEGIN:VEVENT
DTSTART:20060208T180000Z
DTEND:20060208T190000Z
LOCATION;ENCODING=QUOTED-PRINTABLE:Library
UID:20051022T220000ZI-request
DESCRIPTION;ENCODING=QUOTED-PRINTABLE:test
SUMMARY;ENCODING=QUOTED-PRINTABLE:I-request
PRIORITY:3
END:VEVENT
END:VCALENDAR


 
Reply With Quote
 
 
 
 
Ray Costanzo [MVP]
Guest
Posts: n/a
 
      04-01-2005
Have you tried creating a .vcs file in Outlook and comparing it to what
you're making? Here's what my vcs file looks like that I just created in
Outlook 2002.

BEGIN:VCALENDAR
PRODID:-//Microsoft Corporation//Outlook 10.0 MIMEDIR//EN
VERSION:1.0
BEGIN:VEVENT
DTSTART:20050401T160000Z
DTEND:20050401T170000Z
LOCATION;ENCODING=QUOTED-PRINTABLE:Location here
UID:040000008200E00074C5B7101A82E00800000000E017AA 4D9F36C5010000000000000000
100
000000D8C46368444C44597269263FBA4BF73
SUMMARY;ENCODING=QUOTED-PRINTABLE:Subject here
PRIORITY:3
END:VEVENT
END:VCALENDAR

Ray at work

"Tom Petersen" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Here is a little more info, sorry should have explained what my final goal
> was. I am creating a .vcs file from a form to import into Outlook.
>
> This gernerates an error message in Outlook stating it can't import the
> calendar file.


> Final .vcs contents:
> BEGIN:VCALENDAR
> VERSION:1.0
> BEGIN:VEVENT
> DTSTART:20060208T180000Z
> DTEND:20060208T190000Z
> LOCATION;ENCODING=QUOTED-PRINTABLE:Library
> UID:20051022T220000ZI-request
> DESCRIPTION;ENCODING=QUOTED-PRINTABLE:test
> SUMMARY;ENCODING=QUOTED-PRINTABLE:I-request
> PRIORITY:3
> END:VEVENT
> END:VCALENDAR
>
>



 
Reply With Quote
 
 
 
 
Tom Petersen
Guest
Posts: n/a
 
      04-01-2005
Ok, strange, I sent the output to a text file instead of straight to .vcs,
and I get the source code for the page (cal.asp) instead of just the stuff I
want:
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 6.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title></title>

<STYLE>
A {text-decoration: none;}
</STYLE>
</head>
<body link="#0063CE" vlink="#0063CE" alink="#0063CE">



<div align="center">
<center>
<table border="0" cellpadding="4" cellspacing="0" height="1"
style="border: 2 solid #808080">
<tr>
<td height="1" bgcolor="#0063CE" valign="bottom" align="left"><a
href="http://sd-school/index.asp"><font color="#FFFFFF" face="Verdana"
size="1">Home</font></a></td>
<td height="1" bgcolor="#0063CE" valign="bottom" align="left"><a
href="http://sd-school/forms.asp"><font color="#FFFFFF" face="Verdana"
size="1">Forms</font></a></td>
<td height="1" bgcolor="#0063CE" valign="bottom" align="left"><a
href="http://sd-school/policies.asp"><font color="#FFFFFF" face="Verdana"
size="1">Policies</font></a></td>
<td height="1" bgcolor="#0063CE" valign="bottom" align="left"><a
href="http://sd-school/schedule/Page.asp"><font color="#FFFFFF"
face="Verdana" size="1">Schedule</font></a></td>
<td height="1" bgcolor="#0063CE" valign="bottom" align="left"><a
href="http://sd-school/staff_directory.asp"><font color="#FFFFFF"
face="Verdana" size="1">Directory</font></a></td>
<td height="1" bgcolor="#0063CE" valign="bottom" align="left"><a
href="http://sd-school/publications/publications.asp"><font color="#FFFFFF"
face="Verdana" size="1">Publications</font></a></td>
<td height="1" bgcolor="#0063CE" valign="bottom" align="left"><a
href="http://sd-school/support/support.asp"><font color="#FFFFFF"
face="Verdana" size="1">Support</font></a></td>
<td height="1" bgcolor="#0063CE" valign="bottom" align="left"><a
href="http://sd-school/workshop/workshop.asp"><font color="#FFFFFF"
face="Verdana" size="1">Workshops</font></a></td>
<td height="1" bgcolor="#0063CE" valign="bottom" align="left"><a
href="http://sd-school/forms/adminmenu.asp"><font color="#FFFFFF"
face="Verdana" size="1">Admin</font></a></td>
</tr>
</table>
</center>
</div>

</body>

</html>
BEGIN:VCALENDAR
VERSION:1.0
BEGIN:VEVENT
DTSTART:20051122T170000Z
DTEND:20051122T170000Z
LOCATION;ENCODING=QUOTED-PRINTABLE:Library
UID:20051122T170000ZI-request
DESCRIPTION;ENCODING=QUOTED-PRINTABLE:test
SUMMARY;ENCODING=QUOTED-PRINTABLE:I-request
PRIORITY:3
END:VEVENT
END:VCALENDAR

So I do get what I need, but whole lot more!
Here is the code that is generating this, any ideas on how to fix:

strStart = strYear & strMonth & strDay & "T" & strHour & strMin & strSec &
"Z"


strvCalendar = "BEGIN:VCALENDAR" & vbCrLf & _
"VERSION:1.0" & vbCrLf & _
"BEGIN:VEVENT" & vbCrLf & _
"DTSTART:" & strStart & vbCrLf & _
"DTEND:" & strStart & vbCrLf & _
"LOCATION;ENCODING=QUOTED-PRINTABLE:" & strLocation & vbCrLf & _
"UID:" & strStart & strSubject & vbCrLf & _
"DESCRIPTION;ENCODING=QUOTED-PRINTABLE:" & strDescription & vbCrLf & _
"SUMMARY;ENCODING=QUOTED-PRINTABLE:" & strSubject & vbCrLf & _
"PRIORITY:3" & vbCrLf & _
"END:VEVENT" & vbCrLf & _
"END:VCALENDAR" & vbCrLf

'Response.ContentType = "text/x-vCalendar"
Response.ContentType = "application/octet-stream"
Response.AddHeader "Content-Disposition", "attachment; filename=cal.txt"
'Response.AddHeader "Content-Disposition", _
' "filename=Event" & "cal.txt"
Response.Write strvCalendar
' Response.End

Now, I'm not done generating the calrndar data, but what I have so far is
valid. I'm guessing my problem lies with the last 7 lines of the code...



 
Reply With Quote
 
Tom Petersen
Guest
Posts: n/a
 
      04-01-2005
Quick follow-up.

I am doing a:
'server.execute "../header.htm"
at the beginning of cal.asp, it is puttin gthe contents of that file into my
Response.Write strvCalendar variable.
Is this normal, any way to stop it from doing that? I commented out that
line and it works great!!! (but I still need to do it!)

TIA


"Tom Petersen" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Ok, strange, I sent the output to a text file instead of straight to .vcs,
> and I get the source code for the page (cal.asp) instead of just the stuff

I
> want:
> <html>
>
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
> <meta name="GENERATOR" content="Microsoft FrontPage 6.0">
> <meta name="ProgId" content="FrontPage.Editor.Document">
> <title></title>
>
> <STYLE>
> A {text-decoration: none;}
> </STYLE>
> </head>
> <body link="#0063CE" vlink="#0063CE" alink="#0063CE">
>
>
>
> <div align="center">
> <center>
> <table border="0" cellpadding="4" cellspacing="0" height="1"
> style="border: 2 solid #808080">
> <tr>
> <td height="1" bgcolor="#0063CE" valign="bottom" align="left"><a
> href="http://sd-school/index.asp"><font color="#FFFFFF" face="Verdana"
> size="1">Home</font></a></td>
> <td height="1" bgcolor="#0063CE" valign="bottom" align="left"><a
> href="http://sd-school/forms.asp"><font color="#FFFFFF" face="Verdana"
> size="1">Forms</font></a></td>
> <td height="1" bgcolor="#0063CE" valign="bottom" align="left"><a
> href="http://sd-school/policies.asp"><font color="#FFFFFF" face="Verdana"
> size="1">Policies</font></a></td>
> <td height="1" bgcolor="#0063CE" valign="bottom" align="left"><a
> href="http://sd-school/schedule/Page.asp"><font color="#FFFFFF"
> face="Verdana" size="1">Schedule</font></a></td>
> <td height="1" bgcolor="#0063CE" valign="bottom" align="left"><a
> href="http://sd-school/staff_directory.asp"><font color="#FFFFFF"
> face="Verdana" size="1">Directory</font></a></td>
> <td height="1" bgcolor="#0063CE" valign="bottom" align="left"><a
> href="http://sd-school/publications/publications.asp"><font

color="#FFFFFF"
> face="Verdana" size="1">Publications</font></a></td>
> <td height="1" bgcolor="#0063CE" valign="bottom" align="left"><a
> href="http://sd-school/support/support.asp"><font color="#FFFFFF"
> face="Verdana" size="1">Support</font></a></td>
> <td height="1" bgcolor="#0063CE" valign="bottom" align="left"><a
> href="http://sd-school/workshop/workshop.asp"><font color="#FFFFFF"
> face="Verdana" size="1">Workshops</font></a></td>
> <td height="1" bgcolor="#0063CE" valign="bottom" align="left"><a
> href="http://sd-school/forms/adminmenu.asp"><font color="#FFFFFF"
> face="Verdana" size="1">Admin</font></a></td>
> </tr>
> </table>
> </center>
> </div>
>
> </body>
>
> </html>
> BEGIN:VCALENDAR
> VERSION:1.0
> BEGIN:VEVENT
> DTSTART:20051122T170000Z
> DTEND:20051122T170000Z
> LOCATION;ENCODING=QUOTED-PRINTABLE:Library
> UID:20051122T170000ZI-request
> DESCRIPTION;ENCODING=QUOTED-PRINTABLE:test
> SUMMARY;ENCODING=QUOTED-PRINTABLE:I-request
> PRIORITY:3
> END:VEVENT
> END:VCALENDAR
>
> So I do get what I need, but whole lot more!
> Here is the code that is generating this, any ideas on how to fix:
>
> strStart = strYear & strMonth & strDay & "T" & strHour & strMin & strSec &
> "Z"
>
>
> strvCalendar = "BEGIN:VCALENDAR" & vbCrLf & _
> "VERSION:1.0" & vbCrLf & _
> "BEGIN:VEVENT" & vbCrLf & _
> "DTSTART:" & strStart & vbCrLf & _
> "DTEND:" & strStart & vbCrLf & _
> "LOCATION;ENCODING=QUOTED-PRINTABLE:" & strLocation & vbCrLf & _
> "UID:" & strStart & strSubject & vbCrLf & _
> "DESCRIPTION;ENCODING=QUOTED-PRINTABLE:" & strDescription & vbCrLf &

_
> "SUMMARY;ENCODING=QUOTED-PRINTABLE:" & strSubject & vbCrLf & _
> "PRIORITY:3" & vbCrLf & _
> "END:VEVENT" & vbCrLf & _
> "END:VCALENDAR" & vbCrLf
>
> 'Response.ContentType = "text/x-vCalendar"
> Response.ContentType = "application/octet-stream"
> Response.AddHeader "Content-Disposition", "attachment; filename=cal.txt"
> 'Response.AddHeader "Content-Disposition", _
> ' "filename=Event" & "cal.txt"
> Response.Write strvCalendar
> ' Response.End
>
> Now, I'm not done generating the calrndar data, but what I have so far is
> valid. I'm guessing my problem lies with the last 7 lines of the code...
>
>
>



 
Reply With Quote
 
Ray Costanzo [MVP]
Guest
Posts: n/a
 
      04-01-2005
Why would you want header HTML in a vcs file? I don't understand.

Ray at home

"Tom Petersen" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Quick follow-up.
>
> I am doing a:
> 'server.execute "../header.htm"
> at the beginning of cal.asp, it is puttin gthe contents of that file into
> my
> Response.Write strvCalendar variable.
> Is this normal, any way to stop it from doing that? I commented out that
> line and it works great!!! (but I still need to do it!)
>
> TIA
>


 
Reply With Quote
 
Tom Petersen
Guest
Posts: n/a
 
      04-04-2005
I don't want them, but somehow, they are getting inserted...


"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:Os17%(E-Mail Removed)...
> Why would you want header HTML in a vcs file? I don't understand.
>
> Ray at home
>
> "Tom Petersen" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Quick follow-up.
> >
> > I am doing a:
> > 'server.execute "../header.htm"
> > at the beginning of cal.asp, it is puttin gthe contents of that file

into
> > my
> > Response.Write strvCalendar variable.
> > Is this normal, any way to stop it from doing that? I commented out

that
> > line and it works great!!! (but I still need to do it!)
> >
> > TIA
> >

>



 
Reply With Quote
 
Tom Petersen
Guest
Posts: n/a
 
      04-04-2005
Figured it out, had Response.End still commented out, seemed to do the
trick.

Thanks for all the help!!!


"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:Os17%(E-Mail Removed)...
> Why would you want header HTML in a vcs file? I don't understand.
>
> Ray at home
>
> "Tom Petersen" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Quick follow-up.
> >
> > I am doing a:
> > 'server.execute "../header.htm"
> > at the beginning of cal.asp, it is puttin gthe contents of that file

into
> > my
> > Response.Write strvCalendar variable.
> > Is this normal, any way to stop it from doing that? I commented out

that
> > line and it works great!!! (but I still need to do it!)
> >
> > TIA
> >

>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Formatting a Web Part Zone in a Content Page (ASP.NET 2) ian ASP .Net 0 11-25-2005 04:42 PM
Variable displays at one part while does not in another part in a Jack ASP General 8 05-10-2005 07:26 PM
ActiveX apologetic Larry Seltzer... "Sun paid for malicious ActiveX code, and Firefox is bad, bad bad baad. please use ActiveX, it's secure and nice!" (ok, the last part is irony on my part) fernando.cassia@gmail.com Java 0 04-16-2005 10:05 PM
Easy part done, now the hard part!! jollyjimpoppy A+ Certification 0 09-10-2003 10:37 AM



Advertisments