?
Solved

Formatting MS Word text after opening.

Posted on 2002-06-18
6
Medium Priority
?
246 Views
Last Modified: 2012-08-13
Hi,
I have been given the task of loading a message into Word which is in gold font(I guess yellow would do). I can open Word no problem but I can't find any information about formatting the text to go inside. The script I am using is

<% @LANGUAGE = VBScript %>
<%
Response.ContentType = "application/msword"
Response.Expires = 0
%>
Message text would appear here (but where do I put the formatting?).

Thanks in advance

Sam
0
Comment
Question by:Sambob
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 20

Accepted Solution

by:
Michel Sakr earned 400 total points
ID: 7090565
try pure html.. it should work..
<% @LANGUAGE = VBScript %>
<%
Response.ContentType = "application/msword"
'Response.Expires = 0  
%>
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title>
</head>
<body>
<p><font color="#FFCC00"><b>Hello world!</b></font></p>
</body>
</html>
0
 

Author Comment

by:Sambob
ID: 7090620
The books I have been looking at suggest that HTML tags would be displayed along with the text so I didn't even bother trying that approach. I'll have a look in the morning and award you the points if all is OK.
Thanks
Sam
0
 
LVL 1

Expert Comment

by:sandyphillips
ID: 7090622
Sambob,

If I understand what you are trying to do, the scripting host will continue to use the "context" you opened up with your command Response.ContentType. That is, it will essentially "open" MS Word in your browser window. Thus, to get a message in a particular color, you could use the Write method of the Response object. So, if I want to have a formatted message, I would use something like the following:

<%
Response.Write "<font color='blue'>This is the one!</font>"
%>

This puts your formatting in-line and lets Word receive the output of the Response object. This will allow you to use all the VBScripting power to format and use variables to create your message.

If you want just plain simple, just embed standard HTML after your ASP command close marker (the %> sign) and Word will interpret it directly. So, in this case, it would look like:

<% @LANGUAGE = VBScript %>
<%
Response.ContentType = "application/msword"
Response.Expires = 0
%>
<font color='blue'>This is the one!</font>.

To show you both, I have composed a little ASP that has both methods (although I don't use any real features of VBScript, it does illustrate the point):
<html>
<!-- Creation date: 6/18/2002 -->
<head>
<title>ASP and Word Demonstration</title>
<meta name="description" content="Demonstration of Word Control from ASP">
<meta name="author" content="sphillips77">
</head>
<body>
<% @LANGUAGE = VBScript %>
<%
Dim strMsg
     strMsg     =     "Message from VBScript!"
     
Response.ContentType = "application/msword"
Response.Expires = 0
Response.Write "<center><h1><font color='blue'>" + strMsg + "</font></h1></center>"
Response.Write "<br><hr><br>"
Response.Write "<p align='center'><font color='green'>Brought to you by MS Scripting Host</font></p>"
%>
<br><hr><br>
<center><h1><font color='blue'>Your plain HTML message here.</font></h1></center>
<p align='center'><font color='green'>Brought to you by MS Scripting Host</font></p>

</body>
</html>

I hope this helps.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 29

Expert Comment

by:Göran Andersson
ID: 7091448
sandyphillips, welcome to EE.
:)

The practice here is not to propose an answer, unless you are:
- first to suggest an answer
- totally covering the subject, leaving nothing more to say

The reason for this is that when you propose an answer, the question is moved to the Locked Questions. That means that few experts will even look at it, so the person asking the questions will probably not getting any more input. That's not really fair to him.

Please read the tips on comments and answers below.
0
 

Author Comment

by:Sambob
ID: 7096117
sandyphillips,
sorry! the question had already been answered adequately by Silvers5 but thank you for answering anyway,
Sam
0
 

Author Comment

by:Sambob
ID: 7096122
How do I now award the points to Silvers5?
Sam
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question