Character missing

When I am trying to write a big string having 8000 characters only less than 2000 characters are showing

itemCell.PutValue(text.ToString(), false, false);

while debugging I am able to see 8000 characters in the field text

@Aromal,

In MS Excel, a worksheet cell can hold up to 32,767 characters. However, only the first 1,024 characters will be visible in the cell. You may try to set wrapping text on while extending column’s width. This way, you may view whole text.

In case, you still could not evaluate or find any issue, kindly do share sample (runnable) code and output Excel file, we will check and assist you accordingly soon.

Is there any option to give wrap text as common to all sheets rather than a cell?

@Aromal,

You can wrap text on a cell, a range of cells, whole column and whole row in a worksheet. See some documents with examples on how to wrap text or other styles/formatting for your reference.
https://docs.aspose.com/cells/net/line-breaks-and-text-wrapping/
https://docs.aspose.com/cells/net/wrapping-cell-text/

I have tried the wrap text but the maximum character showing in pdf is 1527

@Aromal,

Please do create and share a standalone (runnable) project/code with sample files (input file (if any) and output file(s)) to reproduce the issue on our end. We will check your issue soon.

output.pdf (63.8 KB)

Here is the sample code.

using Aspose.Cells;
using Aspose.Cells.Utility;
using Aspose.Pdf.Plugins;
using System.Text.Json;

using FileStream fstream = new(“C:\Users\acm\source\repos\pdfgenerator\Aspose\testBonus.xlsx”, FileMode.Open);
using (Workbook workbook = new(fstream))
{

Worksheet sheet0 = workbook.Worksheets[0];


Aspose.Cells.Range[] nameCell = workbook.Worksheets.GetNamedRanges();


string name = "Myname";
string details = "Character Counter is a 100% free online character count calculator that's simple to use. Sometimes users prefer simplicity over all of the detailed writing information Word Counter provides, and this is exactly what this tool offers. It displays character count and word count which is often the only information a person needs to know about their writing. Best of all, you receive the needed information at a lightning fast speed.\r\n\r\nTo find out the word and character count of your writing, simply copy and paste text into the tool or write directly into the text area. Once done, the free online tool will display both counts for the text that's been inserted. This can be useful in many instances, but it can be especially helpful when you are writing for something that has a character minimum or limit.\r\n\r\nCharacter and word limits are quite common these days on the Internet. The one that most people are likely aware of is the 140 character limit for tweets on Twitter, but character limits aren't restricted to Twitter. There are limits for text messages (SMS), Yelp reviews, Facebook posts, Pinterest pins, Reddit titles and comments, eBay titles and descriptions as well as many others. Knowing these limits, as well as being able to see as you approach them, will enable you to better express yourself within the imposed limits.\r\n\r\nFor students, there are usually limits or minimums for homework assignments. The same is often true for college applications. Abiding by these can have a major impact on how this writing is graded and reviewed, and it shows whether or not you're able to follow basic directions. Character counter can make sure you don't accidentally go over limits or fail to meet minimums that can be detrimental to these assignments.\r\n\r\nThis information can also be quite helpful for writers. Knowing the number of words and characters can help writers better understand the length of their writing, and work to display the pages of their writing in a specific way. For those who write for magazines and newspapers where there is limited space, knowing these counts can help the writer get the most information into that limited space.\r\n\r\nFor job seekers, knowing the number of characters of your resume can be essential to get all the information you want onto a single page. You can fool around with different fonts, their sizes and spacing to adjust the number of characters you can fit on a single page, but it's important to know the number you're attempting to fit on the page.\r\n\r\nCharacter Counter isn't only for English. The tool can be helpful for those writing in non-English languages where character count is important. This can be the case for languages Japanese, Korean, Chinese and many others where characters are the basis of the written language. Even for those who aren't writing in English, knowing the character count of the writing is often beneficial to the writing.Character Counter is a 100% free online character count calculator that's simple to use. Sometimes users prefer simplicity over all of the detailed writing information Word Counter provides, and this is exactly what this tool offers. It displays character count and word count which is often the only information a person needs to know about their writing. Best of all, you receive the needed information at a lightning fast speed.\r\n\r\nTo find out the word and character count of your writing, simply copy and paste text into the tool or write directly into the text area. Once done, the free online tool will display both counts for the text that's been inserted. This can be useful in many instances, but it can be especially helpful when you are writing for something that has a character minimum or limit.\r\n\r\nCharacter and word limits are quite common these days on the Internet. The one that most people are likely aware of is the 140 character limit for tweets on Twitter, but character limits aren't restricted to Twitter. There are limits for text messages (SMS), Yelp reviews, Facebook posts, Pinterest pins, Reddit titles and comments, eBay titles and descriptions as well as many others. Knowing these limits, as well as being able to see as you approach them, will enable you to better express yourself within the imposed limits.\r\n\r\nFor students, there are usually limits or minimums for homework assignments. The same is often true for college applications. Abiding by these can have a major impact on how this writing is graded and reviewed, and it shows whether or not you're able to follow basic directions. Character counter can make sure you don't accidentally go over limits or fail to meet minimums that can be detrimental to these assignments.\r\n\r\nThis information can also be quite helpful for writers. Knowing the number of words and characters can help writers better understand the length of their writing, and work to display the pages of their writing in a specific way. For those who write for magazines and newspapers where there is limited space, knowing these counts can help the writer get the most information into that limited space.\r\n\r\nFor job seekers, knowing the number of characters of your resume can be essential to get all the information you want onto a single page. You can fool around with different fonts, their sizes and spacing to adjust the number of characters you can fit on a single page, but it's important to know the number you're attempting to fit on the page.\r\n\r\nCharacter Counter isn't only for English. The tool can be helpful for those writing in non-English languages where character count is important. This can be the case for languages Japanese, Korean, Chinese and many others where characters are the basis of the written language. Even for those who aren't writing in English, knowing the character count of the writing is often beneficial to the writing.Character Counter is a 100% free online character count calculator that's simple to use. Sometimes users prefer simplicity over all of the detailed writing information Word Counter provides, and this is exactly what this tool offers. It displays character count and word count which is often the only information a person needs to know about their writing. Best of all, you receive the needed information at a lightning fast speed.\r\n\r\nTo find out the word and character count of your writing, simply copy and paste text into the tool or write directly into the text area. Once done, the free online tool will display both counts for the text that's been inserted. This can be useful in many instances, but it can be especially helpful when you are writing for something that has a character minimum or limit.\r\n\r\nCharacter and word limits are quite common these days on the Internet. The one that most people are likely aware of is the 140 character limit for tweets on Twitter, but character limits aren't restricted to Twitter. There are limits for text messages (SMS), Yelp reviews, Facebook posts, Pinterest pins, Reddit titles and comments, eBay titles and descriptions as well as many others. Knowing these limits, as well as being able to see as you approach them, will enable you to better express yourself within the imposed limits.\r\n\r\nFor students, there are usually limits or minimums for homework assignments. The same is often true for college applications. Abiding by these can have a major impact on how this writing is graded and reviewed, and it shows whether or not you're able to follow basic directions. Character counter can make sure you don't accidentally go over limits or fail to meet minimums that can be detrimental to these assignments.\r\n\r\nThis information can also be quite helpful for writers. Knowing the number of words and characters can help writers better understand the length of their writing, and work to display the pages of their writing in a specific way. For those who write for magazines and newspapers where there is limited space, knowing these counts can help the writer get the most information into that limited space.\r\n\r\nFor job seekers, knowing the number of characters of your resume can be essential to get all the information you want onto a single page. You can fool around with different fonts, their sizes and spacing to adjust the number of characters you can fit on a single page, but it's important to know the number you're attempting to fit on the page.\r\n\r\nCharacter Counter isn't only for English. The tool can be helpful for those writing in non-English languages where character count is important. This can be the case for languages Japanese, Korean, Chinese and many others where characters are the basis of the written language. Even for those who aren't writing in English, knowing the character count of the writing is often beneficial to the writing.";

foreach(var item in nameCell)
{
    if(item.Name =="name")
    {
        item.PutValue(name, false, false);
    }
    if (item.Name == "details")
    {
        item.PutValue(details, false, false);
    }
}

workbook.Save("C:\\Users\\acm\\source\\repos\\

output.pdf (63.8 KB)

pdfgenerator\Aspose\output.pdf", Aspose.Cells.SaveFormat.Pdf);
}

Here is the sample code. Here the “details” variable contain a string having length more than 8000 characters. I need this to printed in the details section of the PDF

@Aromal,

Thanks for the sample PDF document and sample code segment.

Please note, an Excel cell can store 32K chars (in its source xml archives) but MS Excel can only display limited sets of chars. As suggested earlier, you need to apply wrapping text (option) for the cell. Secondly, you need to extend the column’s width up to its maximum level, i.e., 255 chars and set row height to 409 points (when you apply auto-fit row(s) operation, it can extend to maximum row height). This way you will get maximum text display in output Excel file and output PDF file. See the following sample code for your reference. Also, find attached both Excel and PDF files in the zipped archive.
e.g.
Sample code:

Workbook workbook = new Workbook();
Worksheet sheet0 = workbook.Worksheets[0];

string details = "Character Counter is a 100% free online character count calculator that's simple to use. Sometimes users prefer simplicity over all of the detailed writing information Word Counter provides, and this is exactly what this tool offers. It displays character count and word count which is often the only information a person needs to know about their writing. Best of all, you receive the needed information at a lightning fast speed.\r\n\r\nTo find out the word and character count of your writing, simply copy and paste text into the tool or write directly into the text area. Once done, the free online tool will display both counts for the text that's been inserted. This can be useful in many instances, but it can be especially helpful when you are writing for something that has a character minimum or limit.\r\n\r\nCharacter and word limits are quite common these days on the Internet. The one that most people are likely aware of is the 140 character limit for tweets on Twitter, but character limits aren't restricted to Twitter. There are limits for text messages (SMS), Yelp reviews, Facebook posts, Pinterest pins, Reddit titles and comments, eBay titles and descriptions as well as many others. Knowing these limits, as well as being able to see as you approach them, will enable you to better express yourself within the imposed limits.\r\n\r\nFor students, there are usually limits or minimums for homework assignments. The same is often true for college applications. Abiding by these can have a major impact on how this writing is graded and reviewed, and it shows whether or not you're able to follow basic directions. Character counter can make sure you don't accidentally go over limits or fail to meet minimums that can be detrimental to these assignments.\r\n\r\nThis information can also be quite helpful for writers. Knowing the number of words and characters can help writers better understand the length of their writing, and work to display the pages of their writing in a specific way. For those who write for magazines and newspapers where there is limited space, knowing these counts can help the writer get the most information into that limited space.\r\n\r\nFor job seekers, knowing the number of characters of your resume can be essential to get all the information you want onto a single page. You can fool around with different fonts, their sizes and spacing to adjust the number of characters you can fit on a single page, but it's important to know the number you're attempting to fit on the page.\r\n\r\nCharacter Counter isn't only for English. The tool can be helpful for those writing in non-English languages where character count is important. This can be the case for languages Japanese, Korean, Chinese and many others where characters are the basis of the written language. Even for those who aren't writing in English, knowing the character count of the writing is often beneficial to the writing.Character Counter is a 100% free online character count calculator that's simple to use. Sometimes users prefer simplicity over all of the detailed writing information Word Counter provides, and this is exactly what this tool offers. It displays character count and word count which is often the only information a person needs to know about their writing. Best of all, you receive the needed information at a lightning fast speed.\r\n\r\nTo find out the word and character count of your writing, simply copy and paste text into the tool or write directly into the text area. Once done, the free online tool will display both counts for the text that's been inserted. This can be useful in many instances, but it can be especially helpful when you are writing for something that has a character minimum or limit.\r\n\r\nCharacter and word limits are quite common these days on the Internet. The one that most people are likely aware of is the 140 character limit for tweets on Twitter, but character limits aren't restricted to Twitter. There are limits for text messages (SMS), Yelp reviews, Facebook posts, Pinterest pins, Reddit titles and comments, eBay titles and descriptions as well as many others. Knowing these limits, as well as being able to see as you approach them, will enable you to better express yourself within the imposed limits.\r\n\r\nFor students, there are usually limits or minimums for homework assignments. The same is often true for college applications. Abiding by these can have a major impact on how this writing is graded and reviewed, and it shows whether or not you're able to follow basic directions. Character counter can make sure you don't accidentally go over limits or fail to meet minimums that can be detrimental to these assignments.\r\n\r\nThis information can also be quite helpful for writers. Knowing the number of words and characters can help writers better understand the length of their writing, and work to display the pages of their writing in a specific way. For those who write for magazines and newspapers where there is limited space, knowing these counts can help the writer get the most information into that limited space.\r\n\r\nFor job seekers, knowing the number of characters of your resume can be essential to get all the information you want onto a single page. You can fool around with different fonts, their sizes and spacing to adjust the number of characters you can fit on a single page, but it's important to know the number you're attempting to fit on the page.\r\n\r\nCharacter Counter isn't only for English. The tool can be helpful for those writing in non-English languages where character count is important. This can be the case for languages Japanese, Korean, Chinese and many others where characters are the basis of the written language. Even for those who aren't writing in English, knowing the character count of the writing is often beneficial to the writing.Character Counter is a 100% free online character count calculator that's simple to use. Sometimes users prefer simplicity over all of the detailed writing information Word Counter provides, and this is exactly what this tool offers. It displays character count and word count which is often the only information a person needs to know about their writing. Best of all, you receive the needed information at a lightning fast speed.\r\n\r\nTo find out the word and character count of your writing, simply copy and paste text into the tool or write directly into the text area. Once done, the free online tool will display both counts for the text that's been inserted. This can be useful in many instances, but it can be especially helpful when you are writing for something that has a character minimum or limit.\r\n\r\nCharacter and word limits are quite common these days on the Internet. The one that most people are likely aware of is the 140 character limit for tweets on Twitter, but character limits aren't restricted to Twitter. There are limits for text messages (SMS), Yelp reviews, Facebook posts, Pinterest pins, Reddit titles and comments, eBay titles and descriptions as well as many others. Knowing these limits, as well as being able to see as you approach them, will enable you to better express yourself within the imposed limits.\r\n\r\nFor students, there are usually limits or minimums for homework assignments. The same is often true for college applications. Abiding by these can have a major impact on how this writing is graded and reviewed, and it shows whether or not you're able to follow basic directions. Character counter can make sure you don't accidentally go over limits or fail to meet minimums that can be detrimental to these assignments.\r\n\r\nThis information can also be quite helpful for writers. Knowing the number of words and characters can help writers better understand the length of their writing, and work to display the pages of their writing in a specific way. For those who write for magazines and newspapers where there is limited space, knowing these counts can help the writer get the most information into that limited space.\r\n\r\nFor job seekers, knowing the number of characters of your resume can be essential to get all the information you want onto a single page. You can fool around with different fonts, their sizes and spacing to adjust the number of characters you can fit on a single page, but it's important to know the number you're attempting to fit on the page.\r\n\r\nCharacter Counter isn't only for English. The tool can be helpful for those writing in non-English languages where character count is important. This can be the case for languages Japanese, Korean, Chinese and many others where characters are the basis of the written language. Even for those who aren't writing in English, knowing the character count of the writing is often beneficial to the writing.";

Aspose.Cells.Cell cell1 = sheet0.Cells["A1"];
cell1.PutValue(details);

//Refer to this segment and add to or update your code accordingly
Style style = cell1.GetStyle();
style.IsTextWrapped = true;
style.VerticalAlignment = TextAlignmentType.Top;
cell1.SetStyle(style);

sheet0.Cells.SetColumnWidth(0,255);//we can only set upto 255 chars as maximum width in Excel

//this will extend the row height to its maximum level
sheet0.AutoFitRow(0);

workbook.Save("g:\\test2\\out1.xlsx");
workbook.Save("g:\\test2\\out12.pdf");

Hope, this will help and you understand now.
files1.zip (60.5 KB)

@amjad_sahi But this field can be any data. the value coming to this field is a dynamic one. May be it can be 2 characters or 8000 characters.
Colum width cannot be of maximum. If I do so it will break my template.

Because I need to show all the data what user enters in the respective field

@Aromal,

Please note, MS Excel cannot display so many chars for a cell (this is MS Excel’s limit), so, you should split your 8000 (chars) data into multiple cells by yourselves, so each cell’s data should be visible properly. You may first check the length of the characters to be retrieved then evaluate to set column’s width and wrapping text attributes. Moreover, I just gave you an example that you can set column width up to 255 chars. You may set your column’s width with reasonable width for your needs.