Hi All,
we need to create a TextBox in side Excel to hold a rich text string. so after final report export, users can adjust the text postion.
so i have tried following code from my jsp . but i am not seeting the text at all.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page language="java" pageEncoding="ISO-8859-1"%>
<%@ page import="org.apache.poi.hssf.usermodel.HSSFSheet"%>
<%@ page import="org.apache.poi.hssf.usermodel.HSSFWorkbook"%>
<%@ page import="org.apache.poi.hssf.usermodel.HSSFPrintSetup"%>
<%@ page import="org.apache.poi.hssf.usermodel.HSSFPatriarch"%>
<%@ page import="org.apache.poi.hssf.usermodel.HSSFClientAnchor"%>
<%@ page import="org.apache.poi.hssf.usermodel.HSSFTextbox"%>
<%@ page import="org.apache.poi.hssf.usermodel.HSSFRichTextString"%>
<%@ page contentType="application/vnd.ms-excel" %>
<%@ page import="java.io.*" %>
<%@ page import="java.util.*" %>
<%@taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
<%@taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%>
<html:html>
<head>
<link rel="stylesheet" href="../../../theme/Master.css" type="text/css">
<title>POI</title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta name="GENERATOR" content="Rational Software Architect">
</head>
<body>
<%
try{
HSSFWorkbook hwb = new HSSFWorkbook();
HSSFSheet sheet = hwb.createSheet("new sheet");
HSSFPatriarch patriarch = sheet.createDrawingPatriarch();
HSSFTextbox textbox1 = patriarch.createTextbox
(new HSSFClientAnchor(0,0,0,0,(short)1,1,(short)2,2));
textbox1.setString(new HSSFRichTextString("Rajesh Kumar") );
FileOutputStream fileOut = new FileOutputStream
("c:\\excel\\createBox.xls");
hwb.write(fileOut);
fileOut.close();
out.println("Your excel file has been generated");
} catch ( Exception ex ) {
}%>
</body>
</html:html>
any idea why i am not able to ?