Hi I am unable to make changes to the IPortionFormat of an IDataLabel to Bold the font, change the color, and change the font type. I’ve been research, looking over, and even updated to the latest version of aspose slides in my java springboot project and it is still not working.
Screenshot 2025-10-29 at 10.40.13 PM.png (244.1 KB)
Screenshot 2025-10-29 at 10.39.55 PM.png (76.1 KB)
@hekp100
It seems you’re having trouble modifying the IPortionFormat of an IDataLabel in Aspose.Slides to change the font style, color, and type. Here’s a basic example of how to achieve this in Java:
import com.aspose.slides.*;
public class ModifyDataLabel {
public static void main(String[] args) {
// Load your presentation
Presentation presentation = new Presentation("your_presentation.pptx");
// Access the first slide
ISlide slide = presentation.getSlides().get_Item(0);
// Access the first shape (assuming it's a chart with data labels)
IChart chart = (IChart) slide.getShapes().get_Item(0);
// Access the data label
IDataLabel dataLabel = chart.getChartData().getSeries().get_Item(0).getDataLabels();
// Modify the font properties
IPortionFormat portionFormat = dataLabel.getTextFormat().getPortions().get_Item(0).getPortionFormat();
portionFormat.setBold(true);
portionFormat.setFontColor(Color.RED); // Change to your desired color
portionFormat.setFontHeight(12); // Set your desired font size
// Save the modified presentation
presentation.save("modified_presentation.pptx", SaveFormat.Pptx);
}
}
Ensure that you are accessing the correct data label and that the chart has data labels enabled. If you continue to face issues, please verify that the chart type supports data labels and that the version of Aspose.Slides you are using is compatible with your code.
For additional assistance, consider checking the official Aspose documentation or community forums for similar issues and solutions.
@hekp100,
I was unable to reproduce the problem you encountered. The following code example works fine with Aspose.Slides for Java 25.10:
Presentation presentation = new Presentation("sample.pptx");
ISlide slide = presentation.getSlides().get_Item(0);
IChart chart = (IChart) slide.getShapes().get_Item(0);
IChartSeries chartSeries = chart.getChartData().getSeries().get_Item(0);
IChartDataPoint dataPoint = chartSeries.getDataPoints().get_Item(0);
IChartPortionFormat portionFormat = dataPoint.getLabel().getDataLabelFormat().getTextFormat().getPortionFormat();
portionFormat.setFontBold(NullableBool.True);
portionFormat.getFillFormat().setFillType(FillType.Solid);
portionFormat.getFillFormat().getSolidFillColor().setColor(Color.green);
portionFormat.setLatinFont(new FontData("Arial"));
portionFormat.setFontHeight(20);
presentation.save("output.pptx", SaveFormat.Pptx);
presentation.dispose();
Files:
files.zip (77.5 KB)
More examples:
Create or Update PowerPoint Presentation Charts in Java|Aspose.Slides Documentation
Chart Formatting|Aspose.Slides Documentation
I hope this will help you. If the issue persists, please share the presentation file and standalone code example to reproduce the issue. Then, we will do our best to help you.
Hi, I an opening a document (a LiveDoc powerpoint presentation) generated with Seismic API
This is being done in a Springboot Java project
I have Java 17 installed into the project
I have Springboot version 3.2.2
I was wondering what I could do to fix this.
@hekp100,
We need more details to investigate the case. Please share the following files and information:
- The sample presentation file (if you used it).
- The simplest standalone code example to reproduce the problem.
- The Aspose.Slides version you are using.
You can zip the files and upload the archive here.
Hello, I am unable to share the sample presentation file due to confidentiality of the contents of the presentation.
I already sent the code example. i am using aspose slides 25.10.
If i need to update the java version or the springboot version please let me know.
@hekp100,
We would greatly appreciate it if you could remove the confidential contents from the presentation and share the file.
Unfortunately, I cannot restore the complete code example from the screenshots you shared above. We need a standalone code example in a text file.