Open thlju opened 6 years ago
Can you try adding two div tags as below? Worked for me.
Add-PnPClientSideText -Page "table_page" -Text '
<div class="canvasRteResponsiveTable">
<div class="tableWrapper">
<table title="Table">
<tbody>
<tr>
<td>This is cell 1</td>
<td>This is cell 2</td>
</tr>
</tbody>
</table>
</div>
</div>`
Yes, it works when I wrap the table in the two div tags as you suggested.
I also created a page with some tables using the SharePoint GUI and noticed that all tables are automatically wrapped in these divs. Good to know.
Thanks for this, it really helped!
Notice: many issues / bugs reported are actually related to the PnP Core Library which is used behind the scenes. Consider carefully where to report an issue:
Apply-SPOProvisioningTemplate
orGet-SPOProvisioningTemplate
? The issue is most likely related to the Provisioning Engine. The Provisioning engine is not located in the PowerShell repo. Please report the issue here: https://github.com/officedev/PnP-Sites-Core/issues.Reporting an Issue or Missing Feature
I'm experiencing an issue when using PowerShell to create modern pages containing HTML tables. I use
Add-PnPClientSideText
to add a table (see code below).The pages are created with tables, but when I enter edit mode the tables are gone. Just an empty Text web part appears. If I press "Discard changes" (to enter display mode without changes), the page is displayed without tables. However, if I press F5 the page displays correctly. Should I choose to press "Save and close" or "Publish" when in edit mode, the tables are lost forever.
Expected behavior
If I add a table I expect it to appear on the page both on display and edit modes, i.e. I expect the page to be editable.
Actual behavior
When entering edit mode, the tables disappeares.
Steps to reproduce behavior
Run this from Windows PowerShell ISE:
Connect-PnPOnline –Url [my url here] –Credentials (Get-Credential)
Add-PnPClientSidePage -Name "table_page"
Add-PnPClientSideText -Page "table_page" -Text "<table><tr><td>This is cell 1</td><td>This is cell 2</td></tr></table>"
Which version of the PnP-PowerShell Cmdlets are you using?
What is the version of the Cmdlet module you are running?
SharePointPnPPowerShellOnline
How did you install the PnP-PowerShell Cmdlets?