Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to set global overflow property to visible? #1013

Closed
fadeli1 opened this issue Jul 16, 2022 · 5 comments
Closed

How to set global overflow property to visible? #1013

fadeli1 opened this issue Jul 16, 2022 · 5 comments

Comments

@fadeli1
Copy link

fadeli1 commented Jul 16, 2022

birt version: 4.9.0

Problem description:
I have a table with 10 columns, one of which is the cell content, because the column width causes the text to be truncated, not full, only half of the text is displayed, this happens when exporting the word document

Solution:
The test found that by setting the control property overflow to visible, the text was displayed correctly, and the property defaulted to inheritance

I want to set the global overflow property to default to visible, how can I do this?

@fadeli1
Copy link
Author

fadeli1 commented Jul 17, 2022

Later, by modifying the source code, I changed
org.eclipse.birt.report.engine.emitter.wpml.writer.AbstractWordXmlWriter

if (isField) {
	writeAutoText(type);
} else {
	// get text attribute overflow hidden
	// and run the function to emulate if true
	if (CSSConstants.CSS_OVERFLOW_HIDDEN_VALUE.equals(style.getOverflow())) {
		txt = cropOverflowString(txt, style, fontFamily, paragraphWidth);
	}
	writeString(txt, style);
}

to

if (isField) {
	writeAutoText(type);
} else {
	writeString(txt, style);
}

Export the doc document, the content is displayed normally, not truncated

Is there a way for me to change the default value of the overflow property to be visible, currently its default value is inherited, the default is hidden

@hvbtup
Copy link
Contributor

hvbtup commented Jul 18, 2022

I think this only happens with long words (which are common in e.g. German text).
You can make it work with a somewhat dirty trick using styles.

Create a predefined style for "label" and set e.g. the whitespace property.
Modify the XML, find the <styles> element

and replace

<property name="whitespace">nowrap</property>

with

<property name="overflow">visible</property>

inside the element <style name="label" ...>.

Duplicate this style twice and choose "text-data" and "text" for the other styles.

Finally, it should look like this:

<styles>
    <style name="label" id="28">
        <property name="overflow">visible</property>
    </style>
    <style name="text" id="29">
        <property name="overflow">visible</property>
    </style>
    <style name="text-data" id="30">
        <property name="overflow">visible</property>
    </style>
</styles>

Now you do not longer need to manually change the "Overflow" property in the "advanced" tab for every label or text.

You could probably also use a theme in a library and use that theme in the report, instead of adding the 3 styles directly to every report.

The "dirty" thing here is that "overflow" cannot be set in the style editor dialog.

@hvbtup
Copy link
Contributor

hvbtup commented Jul 26, 2022

@fadeli1 Does the workaround I proposed work for you?

@hvbtup
Copy link
Contributor

hvbtup commented Jul 26, 2022

See also #916

@fadeli1
Copy link
Author

fadeli1 commented Jul 28, 2022

@hvbtup Sorry for the delay, I tested your solution and it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants