You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2022/01/14 08:55:15 UTC
[Bug 65800] New: Bold Italic Giving space
https://bz.apache.org/bugzilla/show_bug.cgi?id=65800
Bug ID: 65800
Summary: Bold Italic Giving space
Product: POI
Version: 5.1.0-FINAL
Hardware: PC
Status: NEW
Severity: normal
Priority: P2
Component: POI Overall
Assignee: dev@poi.apache.org
Reporter: prasenjit.das2@unilever.com
Target Milestone: ---
Hi,
I am facing error in displaying bold Italics in the Excel using Apache POI.
It is generated with space in between each letter of the bold italics word.
But one more thing in the Excle cell,after I click on any cell the space
between each letter got resolved.
this is only happening in case of Bold Italics.
Please assist.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 65800] Bold Italic Giving space
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65800
PJ Fanning <fa...@yahoo.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
OS| |All
Status|NEW |NEEDINFO
--- Comment #1 from PJ Fanning <fa...@yahoo.com> ---
Can you provide a reproducible test case? Bugzilla is for reporting bugs and
making detailed requests for feature enhancements. If you are looking for
advice on how to use POI, you are better off using stackoverflow.com
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 65800] Bold Italic Giving space
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65800
--- Comment #7 from Prasenjitd <pr...@unilever.com> ---
Please find the sample code.
package com.cara.download.excel.main;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.xssf.usermodel.XSSFFont;
import org.apache.poi.xssf.usermodel.XSSFRichTextString;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
public class CreateWorksheet2 {
private FileOutputStream fileOut;
public void createWorkSheet(XSSFWorkbook wb, String content, String tabName) {
StringBuilder sbFileName = new StringBuilder();
sbFileName.append("test_excel.xlsx");
String fileMacTest = sbFileName.toString();
try {
this.fileOut = new FileOutputStream(fileMacTest);
} catch (FileNotFoundException ex) {
}
Sheet sheet = wb.createSheet(tabName); // Create new sheet w/ Tab name
sheet.setZoom(100); // Set sheet zoom: 100%
// begin insertion of values into cells
Row dataRow = sheet.createRow(0);
Cell A = dataRow.createCell(0);
XSSFRichTextString richText = new XSSFRichTextString();
for (int i = 0; i < content.length(); i++) {
Font currentFont = wb.createFont();
currentFont.setItalic(true); // italic creates space
currentFont.setUnderline(Font.U_SINGLE);
if (currentFont != null)
richText.append(Character.toString(content.charAt(i)), (XSSFFont) currentFont);
}
A.setCellValue(richText);
sheet.autoSizeColumn(0);
try {
// Write the output to a file
wb.write(fileOut);
fileOut.close();
} catch (IOException ex) {
}
}
public static void main(String[] args) {
String content = "GREH"; // content to be added to excel
CreateWorksheet2 createWorksheet = new CreateWorksheet2();
XSSFWorkbook wb = new XSSFWorkbook();
String tabName = "Sheet1";
createWorksheet.createWorkSheet(wb, content, tabName);
}
}
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 65800] Bold Italic Giving space
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65800
--- Comment #5 from PJ Fanning <fa...@yahoo.com> ---
That attachment is gigantic. We are volunteers. I hope noone is going to spend
their time on this.
If you really want assistance. You need to provide a short segment of code that
demonstrates the issue. You should be able to demo this issue with less than 20
lines of code.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 65800] Bold Italic Giving space
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65800
--- Comment #8 from PJ Fanning <fa...@yahoo.com> ---
thanks for the shorter example but this does not look like a bug report to me -
I would suggest that you use stackoverflow.com instead for user advice - there
is a much larger user community on stackoverflow.com
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 65800] Bold Italic Giving space
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65800
--- Comment #9 from PJ Fanning <fa...@yahoo.com> ---
creating the font inside in the loop looks bad to me - excel has a limit on the
number of fonts you can add to a workbook
why not doing something like this (no loop, adds whole content with one
append)?
XSSFRichTextString richText = new XSSFRichTextString();
Font currentFont = wb.createFont();
currentFont.setItalic(true); // italic creates space
currentFont.setUnderline(Font.U_SINGLE);
richText.append(content, (XSSFFont) currentFont);
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 65800] Bold Italic Giving space
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65800
--- Comment #4 from Prasenjitd <pr...@unilever.com> ---
Created attachment 38159
--> https://bz.apache.org/bugzilla/attachment.cgi?id=38159&action=edit
Attachment of bold italics
Please find the attached code.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 65800] Bold Italic Giving space
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65800
--- Comment #6 from Prasenjitd <pr...@unilever.com> ---
Created attachment 38162
--> https://bz.apache.org/bugzilla/attachment.cgi?id=38162&action=edit
Attachment of bold italics
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 65800] Bold Italic Giving space
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65800
--- Comment #10 from Prasenjitd <pr...@unilever.com> ---
Hi there,
We have a requirement where font change can heppen per charecter ,hence the
loops has been implemented.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 65800] Bold Italic Giving space
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65800
--- Comment #2 from Prasenjitd <pr...@unilever.com> ---
Created attachment 38158
--> https://bz.apache.org/bugzilla/attachment.cgi?id=38158&action=edit
Attachment of bold italics
Hi ,
Please use ckEditor like Rich text where you need to make bold and italics of a
word. Now write that text in Excel using apache POI.
The issue will be reproduced.
Attaching one snap shot of the Excel geberated through POI.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 65800] Bold Italic Giving space
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65800
--- Comment #3 from PJ Fanning <fa...@yahoo.com> ---
You will need to provide the code that you used to get you that excel result.
This issue will be closed if you do not provide Java code that demonstrates the
issue.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 65800] Bold Italic Giving space
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65800
--- Comment #12 from Prasenjitd <pr...@unilever.com> ---
Hi there,
Yes it works fine if the font do not change for each char but as per the
requirement we can have different font on charecters leve.
Hecne same was done .But the issue occurs only in case of bold and italic.
Is that an Excel issue?
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 65800] Bold Italic Giving space
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65800
--- Comment #11 from PJ Fanning <fa...@yahoo.com> ---
Can you at least check if the text appears better if you don't change the font
on very char?
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org
[Bug 65800] Bold Italic Giving space
Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=65800
PJ Fanning <fa...@yahoo.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |INFORMATIONPROVIDED
Status|NEEDINFO |RESOLVED
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@poi.apache.org
For additional commands, e-mail: dev-help@poi.apache.org