Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 4 of 4
  1. #1
    Senior Member
    Join Date
    Oct 2007
    Posts
    241
    Member #
    15910
    Hello,
    I am new at using dreamweaver and I have a question. Lets say I pasted a text document with many paragraphs, links, formatting etc....from somewhere into dreamweaver, and then looking into code section now, which dreamweaver generates itself. How can you compress the text in the code section to have no excessive spacing? I am asking because when I try to copy code and paste into my form, if there is a spacing of 2-3 characters or more, the rest of the text does not go into the form field, and I have to return to that point and hit delete, until the rest of the code text comes close to within 1-2 characters of the code before.

    example:
    In the code section assume I have this:
    line 1 <p>text1.................</p> <p>text2..............</p>
    line 2 <p>text3.......</p>

    If i did nothing but select the whole code and try to paste into my form, it only accepts up to end of line 1. The rest does not paste into the form after the point of that too many spacing. I now have to go back to the code, put the cursor end of line1, and hit delete, and delete all space chracaters, until text3 comes up and close to the end of text2.

    so it becomes like this:
    line 1 <p>text1.................</p> <p>text2..............</p> <p>text3.......</p>


    Only then the form accepts the whole selection.

    May be you can even do this in MS word after pasting this code to there. I am wondering how though...It is too repetitive and takes time to do this manually, for a large text where there is too much excesive spacing occuring in the code, when dreamweaver generates it.

  2.  

  3. #2
    Senior Member aeroweb99's Avatar
    Join Date
    Feb 2008
    Location
    Port Huron, Michigan
    Posts
    1,037
    Member #
    16468
    Liked
    1 times
    Ok,

    1) Copy the text from your Word Doc.
    2) Right click in CODE VIEW, not design view, where you need the text to appear
    3) Select "Paste Special" from the context menu
    4) check the box "Text with structure"
    5) Uncheck the box "Clean up Word paragraph spacing"
    6) Click "OK"

    That should do it. It will insert the normal tags and look just like you want it without all the whitespace.

    ***Side Note***
    Whatever you do, don't save the Word Doc as a web page and actually use it for a web page! Word produces the weirdest code I've ever seen for a web page.

  4. #3
    Senior Member
    Join Date
    Oct 2007
    Posts
    241
    Member #
    15910
    thank you, and in the mean time i found this while searching the web....this is a macro in visual basic where you put in ms word.
    Option Explicit

    Sub EliminateMultipleSpaces()
    'If something goes wrong, go to the errorhandler
    On Error GoTo ERRORHANDLER
    'Checks the document for excessive spaces between words
    With Selection
    .HomeKey Unit:=wdStory
    With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    'Here is where it is actually looking for spaces between words
    .Text = " [ ]@([! ])"
    'This line tells it to replace the excessive spaces with one space
    .Replacement.Text = " \1"
    .MatchWildcards = True
    .Wrap = wdFindStop
    .Format = False
    .Forward = True
    'execute the replace
    .Execute Replace:=wdReplaceAll
    End With

    With .Find
    'This time its looking for excessive spaces after a paragraph mark
    .Text = "^p "
    'What to replace it with
    .Replacement.Text = "^p"
    .MatchWildcards = False
    .Wrap = wdFindStop
    .Format = False
    .Forward = True
    'Execute the replace
    .Execute Replace:=wdReplaceAll
    End With
    End With
    ERRORHANDLER:
    With Selection
    .ExtendMode = False
    .HomeKey Unit:=wdStory
    End With
    End Sub

    so first record this macro....then whenever you have such a text in word, first do replace all and replace all ^p with nothing....and then run this macro. that also solves the problem for ms word. And I agree with you thanks for reminding about ms word's weird code, I will keep that in mind...Now i will try yours to see if it works...

  5. #4
    Senior Member
    Join Date
    Oct 2007
    Posts
    241
    Member #
    15910
    I tried yours and it did to a certain extent. It eliminated the spacing but still whenever there is the next line, it does not paste into the form.
    such as
    <p>.......</p>
    <p>.........</p>
    <some tag>...........</some tag>
    so this one above still does not paste, although now all the lines are starting at the very left.
    in order to paste, i still need to go to the end of each line and hit delete once, until it becomes like below:
    <p>.........</p><p>............</p><some tag>..........</some tag><some tag>.............................................. ..........</some tag>
    only then it pastes properly...so your method brings it close, and now instead of hitting delete many times whenever there is spacing, now i only need to hit once at the end of every line....so it is still one step short, but i prefer yours if yourself or someone can explain me how to overcome last step because i dont have to use ms word and take care of everything in dreamweaver....


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 12:56 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com