Text alignment Justify is not working

            PageSetup mainPageSetup = workbook.Worksheets[0].PageSetup;               
            mainPageSetup.SetHeader(0, "&\"Calibri\"&9 " + disclaimer);
            mainPageSetup.PaperSize = PaperSizeType.PaperA4;

            Cell headerCellMainSheet = mainSheet.Cells["A1"];
            Style mainSheetStyle = headerCellMainSheet.GetStyle();
            mainSheetStyle.HorizontalAlignment = TextAlignmentType.Justify;
            headerCellMainSheet.SetStyle(mainSheetStyle);

I tried TextAlignmentType.Justify, TextAlignmentType.Distributed; but it’s not working as expected.
Please correct me if I did any thing wrong.

Right side is not getting aligned properly

image.png (24.6 KB)

@Aromal,

Thanks for the screenshot.

Could you please zip and attach your input Excel file and output Excel file by Aspose.Cells. Also, provide a sample Excel file with your desired alignment settings and display intact, you may create your desired Excel file in MS Excel manually. We will check it soon.

I already tried that one. It won’t work because I need to include disclaimer as header and excel header won’t support that much length

@Aromal,

We need your desired file to know what you want to achieve. Please note, if something cannot be done in MS Excel manually, Aspose.Cells cannot do it as well as it has to follow MS Excel standards and specifications in performing different tasks and features.

Again, we request you to share at least input and output Excel file:

Could you please zip and attach your input Excel file and output Excel file by Aspose.Cells. Also, provide a sample Excel file with your desired alignment settings and display intact, you may create your desired Excel file in MS Excel manually

@Aromal ,

From your code, you are setting HorizontalAlignment of Cell A1 to TextAlignmentType.Justify, TextAlignmentType.Distributed. It has nothing to do with header/footer.

Through my test, TextAlignmentType.Justify, TextAlignmentType.Distributed works OK for Cell A1.