We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Set alignment text in cell

Thread ID:

Created:

Updated:

Platform:

Replies:

142490 Feb 6,2019 10:36 AM UTC Feb 15,2019 05:47 AM UTC ASP.NET Web Forms 11
loading
Tags: DocIO
Pio Luca Valvona
Asked On February 6, 2019 10:36 AM UTC

Hi,
I use this code to insert text into a table cell, but the alignment remains justified.

textRange = table[fornituraHwSw.Count + 10].AddParagraph().AppendText("TOTALE");
                                table[fornituraHwSw.Count + 10].Paragraphs[0].ParagraphFormat.HorizontalAlignment = HorizontalAlignment.Center;


Dilli Babu Nandha Gopal [Syncfusion]
Replied On February 7, 2019 05:54 PM UTC

Hi Pio, 

Thank you for contacting Syncfusion support. 

Yes, the mentioned codes will change the horizontal alignment as center which can also be done as below. 
IWParagraph para = table[0, 0].AddParagraph(); 
para.ParagraphFormat.HorizontalAlignment = Syncfusion.DocIO.DLS.HorizontalAlignment.Center; 

Please share us the complete code example used at your end along with the input document (if any) which will be helpful for us analyzing on the reported behavior. 

To know more about table formatting, please refer the following link. 

Regards, 
Dilli babu. 


Pio Luca Valvona
Replied On February 8, 2019 09:05 AM UTC

Hi,
I use this code to insert text into a table cell, but the alignment remains justified.

textRange = table[fornituraHwSw.Count + 10].AddParagraph().AppendText("TOTALE");
                                table[fornituraHwSw.Count + 10].Paragraphs[0].ParagraphFormat.HorizontalAlignment = HorizontalAlignment.Center;


Hi Dilli,
thanks for response.

I noticed that the problem happens on the docx, because if after I convert the Word file to PDF I get the desired result. I use Libre Office and I am attaching both the file and the code used to populate the template.



Attachment: example_80dc8fba.zip

Jenefa Koilduraijebakumar [Syncfusion]
Replied On February 11, 2019 11:39 AM UTC

Hi Pio,

We have created a input template Word document based on the given code snippet and output Word document to reproduce the reported issue at our end. But we are unable to reproduce the issue. We have attached the sample which we tried at our end for your reference and please find it from below link.

Sample link:
http://www.syncfusion.com/downloads/support/directtrac/general/ze/Sample_ASP.NET-908017430

Note:
Please refer the modified input document in “Data” folder and the code snippet in the “GenerateWord.aspx.cs” file inside the sample.

If you are still facing same issue means, then kindly modify the attached sample or modify the existing sample of yours
along with input and resultant document of your end and provide us to reproduce the issue at our end.


Regards,
Jenefa K



Pio Luca Valvona
Replied On February 12, 2019 09:29 AM UTC

Hi Jenefa,
Thank you for your support. 
Unfortunately, I did not understand what the change, since the code, even if resized is equal to mine, much less I understand the change to the document.
You could explain verbatim the changes, because even using your code the problem does not resolve

Dilli Babu Nandha Gopal [Syncfusion]
Replied On February 13, 2019 12:47 PM UTC

Hi Pio,   

We suspect that your requirement is to apply horizontal alignment for the paragraph “TOTALE”. Kindly add the highlighted codes in your application to achieve it. 
textRange = table[fornituraHwSw.Count + 1, 0].AddParagraph().AppendText("TOTALE"); 
textRange.OwnerParagraph.ParagraphFormat.HorizontalAlignment = HorizontalAlignment.Center; 

If this solution doesn’t suit your requirement, then kindly share us the issue reproducing sample as requested in our last update so that we can analyze and provide a prompt solution at the earliest. 
  
Regards, 
Dilli babu. 


Pio Luca Valvona
Replied On February 13, 2019 02:14 PM UTC

Hi Dilli,
thanks for response.

This solution is also not working.
Because using the suggested code, the paragraph alignment property, opening the document remains set to "justified".
Both by opening it with LibreOffice and with Word Online.



Dilli Babu Nandha Gopal [Syncfusion]
Replied On February 13, 2019 03:31 PM UTC

Hi Pio, 

Kindly share us the issue reproducing sample as requested in our last update so that we can analyze and provide a prompt solution at the earliest.  

If you have any confidential data in your Word document, please replace with some dummy data and provide us the same or send to support@syncfusion.com by mentioning this forum. 
   
Regards, 
Dilli babu. 


Pio Luca Valvona
Replied On February 13, 2019 04:00 PM UTC

Hi Dilli.
I am attaching the generated file with the code used and attached in a previous message.

Attachment: result_662ff8e3.zip

Dilli Babu Nandha Gopal [Syncfusion]
Replied On February 14, 2019 12:26 PM UTC

Hi Pio, 
 
Thank you for your update. 
 
We have prepared a sample based on your requirement with dummy data which can be downloaded from the following link. 
 
Kindly modify the sample to reproduce the issue and share us the same. With the help of issue reproducing sample, we will proceed our investigation and provide you a prompt solution. 
 
Regards, 
Dilli babu. 
 
 


Pio Luca Valvona
Replied On February 14, 2019 02:43 PM UTC

Hi Dilli,
thanks for response.

The solutions you've given me work. Analyzing the code in the example, I saw that the problem is caused by the location of this line of code:
table.ApplyHorizontalMerge(fornituraHwSw.Count + 101);

Moving it as in the code in the example, everything is working correctly.



Dilli Babu Nandha Gopal [Syncfusion]
Replied On February 15, 2019 05:47 AM UTC

Hi Pio, 

We are glad to know that the reported issue has been resolved at your end. Please let us know if you need any further assistance. 

Regards, 
Dilli babu.  


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;