You need to be logged in to post in the forum - Log In

An active JCE Pro Subscription is required to post in the forum - Buy a Subscription

Support is currently Offline

Official support hours
Monday to Friday
09:00 - 17:00 Europe/London (BST)

Please create a new Ticket and we will get back to you as soon as we can.

#100373 Table Cell Border Properties when pasted from MS Word.

Posted in ‘Editor’
This is a public ticket

Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.

Latest post by starlir on Friday, 28 June 2019 11:27 BST

starlir
There is a problem with cell border attributes when copying and pasting in a table from MS Word. The top left cell is always set with the attribute border : 1px solid whilst all remaining cells have all border attributes set without the 1px property. This requires the code to be edited for any table pasted in from Word (ie. remove the 1px property) to ensure all cell borders are the same. This occurs up to and including 2.7.14.

Ryan
I'm not seeing this in my tests. Perhaps it is particular to a specific Word document you are working with?

Can you post an example document, attached as a zip file, that I can test with?

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

starlir
Hi Ryan, thanks for the response. Please find attached the requested zip file. When copying I select just the table (not the title etc)

Attachments

Training Alterations_June 2019.zip

Ryan
Please try JCE Pro 2.7.15 Beta 5 - https://www.joomlacontenteditor.net/downloads/editor/pro/development

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

starlir
Hi Ryan, That does some really strange things. Using the example file I sent you the pasted table ends up with the content copied in twice and the first half of the resulting table has an extra empty column added to it.

I've screen captured the first part of the resulting table.

Attachments

Ryan
I'm not seeing that in my tests. Please send me a login - https://www.joomlacontenteditor.net/contact/site-login

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

starlir
If I create a blank Word document and insert a table with the default 5 columns and 2 rows then this exhibits the same problem as my original post but doesn't duplicate rows and add columns as detailed in my last post.

starlir
Ryan, login created for you.

Ryan
The problem here is that Word creates such a lot of style junk in tables, when it is copied to the clipboard as HTML, that it is very difficult to clean up. For example, the 5 column 2 row table, after some initial clean but before table processing, results in:

<table style="width: 624px; border-collapse: collapse; border: none;">
	<tbody>
		<tr style="height: 58px;">
			<td style="width: 125px; border: 1pt solid windowtext; padding: 0cm 5.4pt; height: 58px;">
				<p> </p>
			</td>
			<td style="width: 125px; border-top: 1pt solid windowtext; border-right: 1pt solid windowtext; border-bottom: 1pt solid windowtext; border-left: none; padding: 0cm 5.4pt; height: 58px;">
				<p> </p>
			</td>
			<td style="width: 125px; border-top: 1pt solid windowtext; border-right: 1pt solid windowtext; border-bottom: 1pt solid windowtext; border-left: none; padding: 0cm 5.4pt; height: 58px;">
				<p> </p>
			</td>
			<td style="width: 125px; border-top: 1pt solid windowtext; border-right: 1pt solid windowtext; border-bottom: 1pt solid windowtext; border-left: none; padding: 0cm 5.4pt; height: 58px;">
				<p> </p>
			</td>
			<td style="width: 125px; border-top: 1pt solid windowtext; border-right: 1pt solid windowtext; border-bottom: 1pt solid windowtext; border-left: none; padding: 0cm 5.4pt; height: 58px;">
				<p> </p>
			</td>
		</tr>
		<tr style="height: 58px;">
			<td style="width: 125px; border-right: 1pt solid windowtext; border-bottom: 1pt solid windowtext; border-left: 1pt solid windowtext; border-top: none; padding: 0cm 5.4pt; height: 58px;">
				<p> </p>
			</td>
			<td style="width: 125px; border-top: none; border-left: none; border-bottom: 1pt solid windowtext; border-right: 1pt solid windowtext; padding: 0cm 5.4pt; height: 58px;">
				<p> </p>
			</td>
			<td style="width: 125px; border-top: none; border-left: none; border-bottom: 1pt solid windowtext; border-right: 1pt solid windowtext; padding: 0cm 5.4pt; height: 58px;">
				<p> </p>
			</td>
			<td style="width: 125px; border-top: none; border-left: none; border-bottom: 1pt solid windowtext; border-right: 1pt solid windowtext; padding: 0cm 5.4pt; height: 58px;">
				<p> </p>
			</td>
			<td style="width: 125px; border-top: none; border-left: none; border-bottom: 1pt solid windowtext; border-right: 1pt solid windowtext; padding: 0cm 5.4pt; height: 58px;">
				<p> </p>
			</td>
		</tr>
	</tbody>
</table>
As you can see the table cell borders are a mix of different styles, which makes conversion to a consistent style quite difficult.

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

starlir
Hi Ryan, yes fully agree. I get sent this document from a third party and it changes almost on a daily basis so I am continually republishing a revised schedule. I guess we have to track down why you are not seeing the same problem. BTW I am on Mac using Safari at OSX 10.14 and Word 16.26 Office Insider Slow Release.

Ryan
I am seeing the same cell border issue, although there are differences between Firefox and Chrome.

I am not seeing the doubled content issue on your site or on my test site, in either Firefox or Chrome.

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

starlir
Ryan,

Apologies, with all the copying and pasting during testing I screwed up the source document, we are back to just the original problem of the top left cell.

Ryan
I will continue working on this, but here is my suggestion to keep you working, and guarantee clean tables with borders:

1. In Editor Profiles -> Plugin Parameters -> Clipboard, add border-collapse,border to the Styles to remove field, eg:

https://cdn.joomlacontenteditor.net/tmp/100373-table-cell-border-properties-when-pasted-from-ms-word.png

2. Copy and paste the table as before. It should be pasted in without solid borders, only showing a dashed border (this is a system style showing an outline of the table)

3. Click somewhere in the table, and click on the Insert A Table button in the toolbar. In the dialog, set Border to 1, click Update.

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

starlir
Ryan, Items 1 and 2 work as per your suggestion but Item 3 does not result in any Borders being added

Ryan
A couple of css tweaks, add these to the templates custom.css file and the jce.css file:

table[border="1"] {
    border-collapse: collapse;
    border-spacing: inherit;
}

table[border="1"] td {
    border: 1px solid #000;
}

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

starlir
Ryan, Yes that works with the removed styles suggested in post 12 still in place. I'm guessing these are temporary fixes?

Ryan
I think I have managed to fix this in JCE Pro 2.7.15 Beta 6 - https://www.joomlacontenteditor.net/downloads/editor/pro/development

However, the alternative method I proposed is actually a better way to deal with this, as it results in cleaner HTML in the article, and gives you more control over the table borders via the css in the template. For example, changing the colour of the table border in all similar tables across the site (those with the border="1" attribute) is easily done by altering the border colour in the template stylesheet.

Ryan Demmer

Lead Developer / CEO / CTO

Just because you're not paranoid doesn't mean everybody isn't out to get you.

starlir
Ryan, thanks. I'll stick with your method, as you say it's more flexible. Appreciate your support.