silverstripe HtmlEditorField with max length of characters? - content-management-system

i´m trying to paste a very long htmlText (130000 Characters) to the content field of a silverstripe page. after saving is done the content field remains blank.
I was able to paste the htmlText directly to the Content field in the database. The database does not complain and I can display the text in the frontend.
So it looks like there is a limitation in the HtmlEditorField. Is there a kind of max length of characters for the HtmlEditorField?
greetz,
Florian

Sounds like a bug to me. HTMLText is limited to 2MB and HtmlEditorField shouldn't add any limit to that IMHO. And I couldn't find anything related to it while taking a quick look at the class on the 3.0 branch.

Related

How to get Delta from a row HTML string in flutter_quill?

Hallow! I need to insert HTML from server to flutter_quill editor, but how to do it? Maybe is it unable thing... Thanks for any answers!
I can make a new document from Delta or from JSON only
As far as I know flutter_quill don't support the html data types. I think it can provide data in delta, plain text & json formats only.
But you can use quill_html_editor library to use the html together with quill editor in flutter. The usage is almost like flutter_quill with more focus on html type content.
To set the html content to editor you just have to set the html string in the controller
await controller.setText(text);
Give it a try. May be it can fulfil your need.

DOCVARIABLE in ms word Field has disappeared, and yet still appears to be functioning. How can I get it back?

First off, sorry if this is really basic, but I've been working with fields in a word document for the past few days and I'm finding them quite counterintuitive. I have a document with over 100 images, and I am sourceing those images using the INCLUDEPICTURE field. Inside that field there is a DOCVARIABLEwhich contains the path to the image. I set this up to display all 1000 images. I then copied this word file and made a new one because I had a second set of images to display. SoI copied and pasted a section of the image name in the field codes and replaced it with a new name, e.g. all "image_a" instances were replaced with "image_b" so instead of seeing "image_a_1.png" and "image_a_2-png", the field codes now show "image_b_1.png" and "image_b_2.png" etc. and this has successfully retrieved the correct images so the document looks good.
However after doing this I have noticed that the codes in the fields has now changed. beforehand at the start the appeared like this:
{ INCLUDEPICTURE "{ DOCVARIABLE "var_doc_path" }folderwithpics\\image_a_1.pgn" \d }
now however after the copy and paste this is what appears:
{ INCLUDEPICTURE "folderwithpics\\image_b_1.pgn" \* MERGEFORMAT \d }
The doc variable is no longer displayed. What's weird that is that the correct image is still sourced and displayed in the word document, so it seems that the docvarible which is essential for the field to reference the correct path, is still active.
There is a problem though, which is that in a new word document, I need to use INCLUDEIMAGE to source all of the 1000 images again into this new document, and they aren't getting displayed. I need to go back and manually enter in the full path for each of the images in order for the new word document to access those image.
I think this must have something to do with the fact that the correct path is no longer displayed. Can anyone help me? I think I need to get the document to display { DOCVARIABLE "var_doc_path" } in the INCLUDEPICTURE field again.
As a side note if anyone has a good guide they can reccommend on working with fields I think that would be a great help. Thanks!
Unless you copied the document via Windows or via SaveAs, rather than simply copying & pasting content from one document to another, the new document will not contain the Document Variable. By using the \d switch, Word is referencing a copy of the image stored in the document metadata rather than the one in the filepath it can no longer access via the DOCVARIABLE field.
FWIW, the \* MERGEFORMAT switch does nothing useful in an INCLUDEPICTURE field.

Converting Email to PDF

I have expended a good deal of effort trying to convert emails to PDF.
I am using Delphi 10.4 although that is not necessarily relevant to the question.
I came up with a solution that involves extraction of the body from the email in whatever format (HTML, RTF or TXT). I use INDY for this or Outlook if email is in MSG format.
I then save the body to file and open it using MS Word via automation. Then it should be a simple matter of saving the Word document in PDF format.
However, MS Word doesn't seem to read html files that well.
From the numerous samples of emails that I have tried, I have come across several issues which were complex to solve.
Examples:
html tables expanding beyond the document's page width. I solved this by working out what the page width is, setting the offending table's width as fixed and setting it to the page width and finally resizing it's columns proportionately to its new width.
That worked well until I tried to process an email with html tables with differing numbers of columns/cells per row. That causes a crash. I solved that by handling the exception and iterating through each table by row and working with its cells rather than columns.
Images within table cells often overlap the cell and the page width. Solved by iterating through all InlineShapes, checking whether they are within a table and, if so setting their width to the cell width.
There have been other issues, but I now have something that seems to work pretty well on a fairly disparate bunch of emails.
But I would think it incredibly likely that there will be new issues that will crop up from time to time and since this procedure is designed to deal unsupervised with batches of emails, this is a concern.
So my question is, does anyone know of a better way of dealing with this? For example, is there some simple way of getting Word to to "nicely" format the html on loading so that it displays and saves to PDF in a readable fashion similar to how it looks when you open the same email in Outlook.
Have you tried using the WordEditor property of the Outlook Inspector object? This returns the Microsoft Word Document Object Model of the message and you can export directly to PDF from that.
Here is a basic example...
Private Sub Demo()
Dim MailItem As MailItem
Dim FileName As String
FileName = "C:\Users\Sam\Desktop\Email.pdf"
Set MailItem = ActiveExplorer.Selection.Item(1)
With MailItem.GetInspector
.WordEditor.ExportAsFixedFormat FileName, 17
.Close 0
End With
MsgBox "Export complete"
End Sub

Sharepoint Rest Api Search query, getting a field with rich text

I am trying to get a field with a rich text but it is striping all the html in the search query. Is there a way to get the html rather than the rich text?
https://{domain}.sharepoint.com/_api/search/query?querytext=%27claim%27&selectproperties=%27Title,Question,Answer%27
<d:Key>Answer</d:Key>
<d:Value xml:space="preserve"> See THIS Form​ . ​ </d:Value>
Answer is the Rich text field with a link in it, When I do a GET (_api/web/lists/getbytitle), it comes back with a link in that field.
Basically, I want to avoid having to call search then call a GET to replace the values.
I solved this by looking through the search properties and using the ID in the path to use a GET List
_api/web/lists/getbytitle('title')/items('1')
then replacing the column in search with the rich text with the one from the GET.
I only need 3 results or so, so this was not a problem for me.
It looks like in the search query, doesnt give back any html tags for the rich text column.

Merging documents using OpenXml and section breaks causes empty paragraphs

I am stitching a couple of documents together with a requirement that each document should retain its header and footer information in the final document. Using AltChunk instead of raw OpenXml or DocumentBuilder saves a lot of effort with regards to styles, formatting, references, parts, etc.
Unfortunately, after a couple of days I can't seem to get a 100% working version due to a small and frustrating issue and I need some insight.
My code is loosly based on this article
I modify each sub document, prior to appending it (as an AltChunk) to a working document, by moving the last section properties into the last paragraph (in order to retain header and footer references), but Word seems to be adding a blank paragraph to each of these documents as it renders them in the final document. I end up with:
document 1 with correct header and footer
section properties/break
blank paragraph
document 2 with correct header and footer
section properties/break
blank paragraph
etc.
I cant remove the blank paragraphs afterwards, as I ideally don't want to use WAS to render the document first.
It seems as if you cannot have a next-page section break without a following paragraph?
After further investigation, it seems that will not be away around my usage scenario. I would need to place the last section properties in the body element, but due to my way of processing with nested AltChunk, it would not work.
I have changed my approach completely and went back to a more detailed append procedure using OpenXml Power Tools and some LINQ to Xml.
I'm using Document Builder and works perfectly for me!
var sources = new List<OpenXmlPowerTools.Source>();
sources.Add(new OpenXmlPowerTools.Source(new WmlDocument(#tempReportPart1)));
sources.Add(new OpenXmlPowerTools.Source(new WmlDocument(#tempReportPart2)));
var outputPath = #"C:\Users\xpto\Documents\TestFolder\myNewDocument.docx";
DocumentBuilder.BuildDocument(sources, outputPath);
I have the similar empty paragraph issue while importing HTML files.
My solution is,
After inserting HTML AltChunk, I add a GUID place holder. After processing the file, I will open the file again, locate the GUID and check if there is a empty paragraph before it, if so remove the empty paragraph and GUID. it seems work perfectly in my solution.
Hope it helps.