Have you ever received a message along the lines of error reading file when trying to open a file in SharePoint Designer (SPD)? Last week I was working on a copy of a NewForm.aspx file. My customer wanted significant changes to the form. Since the form was already live, I checked the file out, made all the changes, tested and then checked the file back in. Everything was great until after the check in. When I tried to make some additional edits by checking the file back out and then opening it, I got an error reading file message. YIKES!!!
If this happens to you, don’t despair! Here’s the fix. First make a copy of the file in SPD so you have a backup. Then in SPD right click on the file and select Open
With/ SharePoint Designer (Open as Text). The file will open and you will see many, many blank lines that are adding unnecessary bulk (in my case I had over 195,000 blank lines interspersed along with my code). At this point you can now delete all the blank lines, save your file and all will be good. Alternately, you can copy all the code and place it in a local file on your computer. Then you can edit out the blank lines in the local file and copy the updated code back into the file in SPD. This alternate approach is a little faster.
Thanks a lot mate.
Just saved my project, and many hours of frustration.
Best regars.
I have found that SPD chokes even if attempting to open as text. Then I tried to at least get the XSLT code by openning the page for editing through my browser, no joy
it also chokes.
What worked for me was this:
- Export the web part through my browser
- Save it locally
- Open that .webpart file with notepad and delete the gazillion blank lines
- Save .webpart file
- Delete the original web part from my page
- Import the web part from my local hard drive and drop it where the original was
Success!!
I’ve had this problem a few time. Most recently, the file in question had several tens of thousands lines of whitespace. I came up with a little trick to make sure I wasn’t deleting anything important: Place cursor at the top of the whitespace, scroll down to the bottom and shift click. Cut and paste it into an excel file, then you can put the filters on the top row and make sure they all say ‘Blank.’ It was alot quicker that way than having to page down through hundreds of pages.
They really need to fix this little bug, it’s a pain.
But anybody knows the reason to generate un necessary blank lines…
I have had this happen many times. I would love to know how to avoid it. Working with SP Designer has caused me countless hours of fixing things that should work. At this point I am very frustrated with Sharepoint and Sharepoint Designer. I would use an alternative if there was one.
I love MS but lately they are like a bad relationship with an ex-girlfriend. Even thought the relationship is unhealthy you keep going back because it is all you have and you don’t know what else to do.