Required control words for RTF Table
First off, awesome work! Glad to see our codepage library was helpful :)
https://jsfiddle.net/omyjg5a9/ generates an RTF table that Word 2016 and OSX TextEdit recognize as a borderless table. rtf.js doesn't seem to recognize this as a table :(
The generator is extremely simple, using a handful of control words for the table block. Here's an example with some comments prefixed by #:
{\rtf1\ansi
\trowd\trautofit1 # start of row
\cellx1\cellx2 # Word seems to need this, even though the widths are not used
\pard\intbl # mark before cells
a\cell # each cell is terminated with the \cell control word
b\cell
\pard\intbl\row # end of row
\trowd\trautofit1
\cellx1\cellx2
\pard\intbl
1\cell
2\cell
\pard\intbl\row
}
A request for table support was already raised in #15 . Based on your understanding of the specification, do those control words suffice to represent a table? If so, would you accept a PR for table support based on those words?
The rtf example you provide seems sufficient for a minimal table (cellx is a required part of the table definition tbldef according to the spec).
We would certainly appreciate a PR for (minimal) table support, we can always later expand it to include all the additional formatting that is possible. @tbluemel originally started implementing this in the branch table-support (including some major rearchitecting to make it work), but that never reached the stability or feature completeness of the current version, none the less it might be interesting to look at that branch for some pointers on implementing it.
If you are still interested, I have just ported the table-support branch to the current master so it is now all typescript and has the test suite, which should make understanding and development a lot easier. You can find it in the branch table-support-typescript.
Nice. I'm still interested, I just don't have the time to work on it currently.
Just wondering if you had time to look into this pr ? I just came across this awesome piece of work and was wondering if/when table support will be included
Unfortunately, I haven't really had time to work on this project recently.
Is there a plan to rebase again table-support-typescript on master in order to have minimal support for tables?
The lib is great and works well for most of my use cases but the lack of table support is kind of a deal breaker atm
Is there any reason why this as never added to master?
I ask because we use 3.0.7 and no table support has become an issue.
I am attempting to get the table-support-typescript branch updated to the latest and changes around RtfDestination.ts and Renderer.ts become unclear which are made as a consequence of the table support and which are updates from the simple fact that the branch is 4 years old @zoehneto @tbluemel
Some validation for myself are needed on the below:
- Seems like Renderer.ts needs to change to use
RenderElement | RenderContainerand not theIContainerelement - There seems to be a few references to using
ChpandPapdirectly and not use RenderChp.ts and RenderPap.ts in RtfDestination.ts - Also in RtfDestination.ts it seems that
_addFormatInsis swapped out for_updateFormatIns, which uses somepropertyChangedstuff and a flush method -
RenderElements.ts used JQuery I've changed for
HtmlElements and addedHelper.addStylein place ofJQuery#css()
Is all the above still needed for Table support or could some stuff be made easier?
Any help will be appreciated!
As stated above the branch never got to a state where it could actually parse anything but simple examples (and not in the 'some things arent't handled yet' but in the 'it crashes randomly' way). That is why it was never merged.