[OfficeUtils] Value too large for the parameter position - GenerateFile (Word)

Forge Component
Published on 29 Jan (4 weeks ago) by Elena Novozhilova
28 votes
Published on 29 Jan (4 weeks ago) by Elena Novozhilova

I am trying to insert a dynamic list to a word file by replacing a placeholder in a template. The approach being done is a continuous replacement of a placeholder with more placeholder, i.e. #info -> item#1 #item2, and so on. The trick works for a certain length then fails-- giving the error "Value too large for the parameter position.". I already tried continuous usage of GenerateFile assuming the error comes from the high record count to the WordFile record being passed around, but the issue still persist.

UPDATE: Issue seems to occur when newlines, i.e. Chr(10) and Chr(13), are involved. I tried reducing them and there was progress of some sort.

UPDATE: There is another trigger for the issue. Apparently if the replaced text is a placeholder in-line with a text the issue happens.


UPDATE: I was able to resolve the issue by performing the replace of everything at the end.

I think the issue I encountered can still be improved by allowing a replace between a recently replaced entity with newline.

For now, I will mark this response as solution to my issue.