cancel
Showing results for 
Search instead for 
Did you mean: 

# in excel download

Former Member
0 Kudos

Hi all,

I used standard excel download option in one application.There is one text column in the table .Whwn I display in excel the test is displayed as #### (ofcourse if the text size is gretaer than 255).Rest is working fine.

Did anybody came across this type of problem.

Any solution please.

Thank you,

Regards,

Rajesh

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Increase the column width in excel it will display the entire content.

Regards

Ayyapparaj

Former Member
0 Kudos

Hi ,

Thank you for immediate reply.How to increase the size of the excel column programatically.The end user should not see that # when he clicks the download to excel.

This is the code used by me to download tje data to excel.


Map m = new HashMap();
	try
	{
		//IWDNode  wdTableNode = wdContext.nodeItab_Report2();
		IWDNode  wdTableNode = null;
		int type1 = type;
		switch(type)
		{
			case 1:
			{
				wdTableNode = wdContext.nodeItab_Report1();
				break;
			}
			case 2:
			{
				wdTableNode = wdContext.nodeItab_Report2();
				break;
			}
			case 3:
			{
				wdTableNode = wdContext.nodeItab_Report3();
				break;
			}
			case 4:
			{
				wdTableNode = wdContext.nodeItab_Report4();
				break;
			}
			default :
			{
				wdTableNode = wdContext.nodeItab_Report1();
				break;
			}
		}
 
		
		byte[] b = null;
		String linktoFile = null;
		StringBuffer err = new StringBuffer();
		StringBuffer xml_file = new StringBuffer();
			
		int noofelem = wdTableNode.size();
			
		ArrayList columnInfos = trimHeaderTexts(columnInfos1);
	
		String nodename = wdTableNode.getNodeInfo().getName().trim();
		String _nodename = nodename.substring(0, 1).toUpperCase()+nodename.substring(1).toLowerCase();
	
		xml_file.append("<?xml version='1.0' encoding='UTF-8' standalone='no'?><")
					.append(_nodename)
					.append(">\n");
				
		int size = columnInfos.size();
	
		for(int i =0;i<noofelem;i++)
		{	
				IWDNodeElement elem = wdTableNode.getElementAt(i);
				xml_file.append("<")
						.append(_nodename)
						.append("Element>");
			
				for (int j = 0;j<columnInfos.size();j++)
				{
					String attributeName = (String)columnInfos.get(j);
					String attributeValue = "";
					if(elem.getAttributeValue(attributeName)!=null)
						attributeValue = elem.getAttributeValue(attributeName).toString().trim();
					xml_file.append("<")
							.append(attributeName)
							.append(">")	
					.append("<![CDATA[")//added by rajesh
//							.append(elem.getAttributeValue(attributeName))
							.append(attributeValue)
					.append("")//added by rajesh
							.append("\n");
						
				}
				xml_file.append("\n");
					
		}
		xml_file.append("\n");
		
		
	
			try 
			{
					b =  xml_file.toString().getBytes("UTF-8");
					IWDCachedWebResource xlfile = WDWebResource.getWebResource(b,WDWebResourceType.XLS);
					xlfile.setResourceName(this.getDropdownText()+" Report ");
				//xlfile.
					linktoFile = xlfile.getURL();
					
					
					IWDWindow win = wdComponentAPI.getWindowManager().createExternalWindow(xlfile.getURL(),"Service Request Details",true);
					win.removeWindowFeature(WDWindowFeature.ADDRESS_BAR);
					win.removeWindowFeature(WDWindowFeature.TOOL_BAR);
					//win.removeWindowFeature(WDWindowFeature.MENU_BAR);
					win.removeWindowFeature(WDWindowFeature.STATUS_BAR);
					win.show();			
			}	
			catch (WDURLException e1) 
			{
				err.append(""+e1.getCause());
			}
			catch (UnsupportedEncodingException e) 
			{
				err.append(""+e.getCause());
			} 
		m.put("data",b);
		m.put("url",linktoFile);
		m.put("error",""+err.toString());
    	
	}
	catch(Exception e)
	{
		this.catchMessage("E","Download To Excel"+e.toString());
	}
	return m;    

]]>

Where can I set the column size in this code.

Thank you,

Regards,

Rajesh

Former Member
0 Kudos

Hi Rajesh,

I also faced the same problem sometime back,

Instead of adding the attribute value directly to the XML string add it as a CDATA section then yr #aggregate will not come.

Regards

Former Member
0 Kudos

Hi,

I already added the CDATA.You can see that in the code.Still it is giving that error.

Thank You,

Regards,

Rajesh

Answers (2)

Answers (2)

Former Member
0 Kudos

closed

Former Member
0 Kudos
Former Member
0 Kudos

Hi Ayaparaj,

The error is due to the property of the column in the excel.If I can change the property of the column from the text to general the error will not come.But dont know how to set the property of column from code.

Any idea on how to set the property.

Thank You,

regards,

Rajesh