Copy and Paste HTML Problems

We have some MS aspx pages that display text on a screen in a layout using tables. The page uses a style sheet plus inline styles. The main table is typically width=580.

It displays and prints properly, but when I copy and pastes into an Outlook 2010 HTML email, it becomes very wide and short, extending off the page to the right with scroll bars.

If I paste it into Word it expands to fit the left/right margins.

Seems to me it is ignoring the table width.
4ncidAsked:
Who is Participating?
 
Julian HansenConnect With a Mentor Commented:
@4ncid - apologies - missed that post.

Content copies and pastes fine into both Word and Outlook 2003 - don't have access to 2010.

Have you tried setting the table width in the css section?

table {
  width: 580px;
  border: 3px solid black;
  border-spacing: 5px;
}

Open in new window

0
 
COBOLdinosaurCommented:
Most CSS does not work in email clients.  Some of the inline stuff will work. Stylesheet are generally ignored.  Depending on user setting HTML may not display at all.


Cd&
0
 
Julian HansenCommented:
Do you have source code / html code we can look at?
0
Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

 
Ron MalmsteadInformation Services ManagerCommented:
What happens when you paste it into Word, ...then copy from Word to an e-mail?
You may also try pasting into Excel first, ....then copy paste from there to the email.
0
 
4ncidAuthor Commented:
Thanks for replies. The solution has to be easy for users - they will not do mutiple steps.

The table width setting is visible in Page Source. I will post screen shot and page source.
0
 
4ncidAuthor Commented:
0
 
4ncidAuthor Commented:
0
 
Paul SauvéRetiredCommented:
I copied the page (case-search.htm) and pasted to Word 2010:Copy to Word.Here is the file:4NCrecordson-8.docxOf course, it is not from the Internet site, sit is difficult to say what the result will be. But if you choose View tab -> Document Views -> Print Layout, you MAY get the same result.
0
 
Julian HansenCommented:
Not enough to go on there.
0
 
COBOLdinosaurCommented:
In addition to the problem of styles in the head being ignored, the non-breaking spaces will not format as space except in a browser interface.

Cd&
0
 
COBOLdinosaurConnect With a Mentor Commented:
I think you need to try an format it as a text file, instead of trying to tag with html.  A text file will retain whatever formatting you give it when it goes into the email client.

Cd7
0
 
Julian HansenCommented:
Just to clarify - are you trying to fix the problem or are you trying to devise a process to copy the data out of the page in a form that you can use it?

If it is just a case of defining a copy process then following on from COBOLdinosaur above I would paste into Notepad first and then into word / outlook - strips all the html and css out so you don't have to worry about the interpretation.
0
 
4ncidAuthor Commented:
Thanks again for responses. More details:

VB.Net runs the code-behind. We deliver this HTML result to the user's browser in response to a user's search.   They may just view it, or print it, or copy into email.  I have no control over what OS, browser, email client, etc. they are using.

But the current complaint is trying to copy and paste into an Outlook email message.  These are typical users and will not take kindly to muliple steps on their part to resolve.

If I change anything I would prefer that it makes more usable for many formats. Hope this helps.
0
 
Julian HansenCommented:
Ok from your answer I take it then that you do have control over how the page is generated? So part of solving the problem could be to adjust the way in which the page is rendered?

If that is the case - to solve the rendering issue need to see the actual markup for the page and the styles.

A view source on the page would do the trick.
0
 
4ncidAuthor Commented:
Yes Julian, I do have control of the page code and generation. There are two of my posts above that include the page source (case-search-source.txt) and the HTML results (case-search.htm).

Thanks again.
0
 
4ncidAuthor Commented:
No JulianH, have not tried that but I will. Thanks.
0
 
4ncidAuthor Commented:
Have not forgotten - just no time to test this yet....
0
 
4ncidAuthor Commented:
Well, none of these ideas worked! Tried setting the width for tables in the page style sheet, making a setting and appplying to a <div> - nada. Always spreads out in the email.

What DID work was adding a carriage return after each line was added as a datarow to the table in code-behind.

Thanks to everyone for your help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.