I am trying to position some Textblocks on a Page.
I have X and Y and W and H coordinates from a Database, that describe a rectangle. I have about 12 of these Rectangles I try to position on a p age.
At the moment the only thing I got working was using shapes and place them relative to The Page with: verticalOrigin="Page", verticalPosition=Y-value and horizontalOrigin="Page", horizontalPosition=X-value. I also have to have an identifier so I can parse the JSON at a later point to know wich of these rectangles have been set initially - for that purpose I use the name attribute of the shape.
That works quite well so far.
The problem i have is the textcontent. I cannot use a shape for that because I cannot have a specific height for the textcontent. I am not able to position a "normal" text block relative to the page and I am also not able to set a name attribute to it because the name will get stripped out of the JSON file.
Is there any possibility to place a textblock onto a page with X and Y coordinates without using a shape ? Or is ther such a thing like a shape with auto-growing height ?
Here is some of my JSON code:
rectangle-shape example (fits my needs):
{
paragraphFormat: {
lineSpacing: 1,
lineSpacingType: "Multiple",
styleName: "Normal",
textAlignment: box.textOrientierung
},
characterFormat: {
fontSize: box.fontSize,
fontFamily: "Arial",
fontSizeBidi: box.fontSize,
fontFamilyBidi: "Arial"
},
inlines: [
{
shapeId: 1 + index,
name: box.boxType,
alternativeText: null,
title: null,
visible: true,
width: Math.round(box.width * TWIP_FACTOR),
height: Math.round(box.height * TWIP_FACTOR),
widthScale: 100.0,
heightScale: 100.0,
lineFormat: {
lineFormatType: "None",
color: "#000000FF",
weight: 1.0,
lineStyle: "Solid"
},
verticalPosition: Math.round(box.startY * TWIP_FACTOR),
verticalOrigin: "Page",
verticalAlignment: "None",
horizontalPosition: Math.round(box.startX * TWIP_FACTOR),
horizontalOrigin: "Page",
horizontalAlignment: "None",
zOrderPosition: 999 + index,
allowOverlap: true,
layoutInCell: true,
lockAnchor: true,
autoShapeType: "Rectangle",
textFrame: {
textVerticalAlignment: "Top",
leftMargin: 0,
rightMargin: 0,
topMargin: 0,
bottomMargin: 0,
blocks: [
{
paragraphFormat: {
styleName: "Normal",
italic: box.italic
},
inlines: [
{
characterFormat: {
fontSize: box.fontSize,
fontSizeBidi: box.fontSize,
italic: box.italic,
bold: box.bold,
fontFamily: "Arial",
fontFamilyBidi: "Arial"
},
text: "[" + box.boxType + "]",
zOrderPosition: 1999 + index,
}
]
}
]
}
}
]
}
"normal" textblock (does not fit my requirements):
{
paragraphFormat: {
styleName: "Header",
listFormat: {}
},
characterFormat: {},
inlines: [text: "My Text"],
name: "myname" (<-- will get lost later in json or sfdt file, like almost any other additional attribute ...)
}
HI Thomas,
Currently,We are validating your query. We will update the details by February 10,2022.
Regards,
Ajithamarlin E
Hi Thomas,
On further checking the reported scenario, we suspect that your requirement is to embed any other control in Document editor. Document editor doesn’t have support for this. Also, SFDT(JSON) will not accept the new attribute.
We do not recommend the user to modify the json because one small minor issue in json affect the document loading.
Please let us know if you have any questions.
Regards,
Suriya M.