Home Tutorialhelp Comment Ensure entire cell is a hyperlink

 
 

Comment

Sumeet
Ensure entire cell is a hyperlink,
June 5, 2008 at 2:37 PM

Hi,

the following is my code for setting a hyperlink to a cell in a table.

------------------ code starts ------------------

private static Table makeTableFromMap(final String firstColumnTitle, final String secondColumnTitle, final java.util.Map m){
Table tab = null;

try{
tab = new Table(2);
}
catch(BadElementException ex){
throw new RuntimeException(ex);
}

tab.setBorderWidth(1.0f);
tab.setPadding(1);
tab.setSpacing(0);

tab.addCell(new Cell(firstColumnTitle));
tab.addCell(new Cell(secondColumnTitle));

tab.endHeaders();

if (m.keySet().size() == 0){
Cell c = new Cell("none");
c.setColspan(2);
tab.addCell(c);
}
else{
Iterator iter = m.keySet().iterator();
while (iter.hasNext()){
String strName = (String) iter.next();
Object value = m.get(strName);
String strValue = null;
if (value == null){
strValue = "";
}
else if (value instanceof String[]){
String[] aValues = (String[]) value;
strValue = aValues[0];
}
/*else if(value instanceof Chunk){
Chunk chunkValue = (Chunk)value;
strValue = chunkValue.getContent();
}*/
else{
strValue = value.toString();
}
Cell nameCell = new Cell(strName);
Cell valueCell = new Cell(strValue);

if(strValue.length() > 40){
int span = strValue.length() % 40;
nameCell.setRowspan(span);
valueCell.setRowspan(span);
}
tab.addCell(nameCell);
tab.addCell(valueCell);
}
}
return tab;
}

--------------------- code ends -----------------

This first parameter is a name(String) and the second parameter is its value(String). Now, if the value is a URL which is more than 40 characters long, I need to ensure that the rowspan of both values is increased accordingly. However, in doing so, the hyperlink for the value String is also truncated. Hence, if the hyperlink was 48 characters, it is changed to 40 characters and the URL does not open. Something like, http://www.google.com gets changed to

http://www.gooo <---- the wrong hyperlink
gle.com

How do i ensure that even after rowspan, the entire URL is not affected?

TIA
View All Comments | View Tutorial
Advertisement
Related Tutorial and Articles
Java Code Examples

itext version
itext version       In this program we are going to find version of  the iText jar file which is using to make a pdf file through the java program. In this example we need 

Programming Tutorials

index
Fortran Tutorials Java Tutorials Java Applet Tutorials Java Swing and AWT Tutorials JavaBeans Tutorials 

Swing AWT

How to create a JTable cell containing Image hyperlink?
How to create a JTable cell containing Image hyperlink?  I'm trying to find out how to create a JTable cell which contains Image, which should be clickable like an hyperlink. I'm able to load Image using default image renderer 

Swing AWT

Use of Hyperlink in Swing - Swing AWT
Use of Hyperlink in Swing  Hi, We are developing the UI using the Java Swing and I have to create Hyperlink in the JTable cell so that if the user click on the Hyperlink it will open other window/screen/panel. My Question 

JSP Servlet Questions

itext pdf
itext pdf  i am generating pdf using java i want to do alignment in pdf using java but i found mostly left and right alignment in a row. i want to divide single row in 4 parts then how can i do 

Java Beginners

What is iText in Java?
What is iText in Java?  Hi, What is iText in Java? How to create PDF in Java? Thanks   Hi, Check the tutorial: Examples of iText. Thanks 

Java-Tutorials

Getting Cell Values in a JTable
;java GetCellValues Cell value of 3 column and 3 row :Biology Cell... Getting Cell Values in a JTable       In this tutorial, you will learn how to get the cell 

IDE Questions

How to open an Acroform in iText?
even heard of iText before this. It's been a while since I did any Java coding... to start. I downloaded iText and have it in C:\ProgramFiles\java\iText...How to open an Acroform in iText?  I modified a client's Acroform 

Java Interview Questions

itext pdf - Java Interview Questions
itext pdf  sample program to modify the dimensions of image file in itext in java  HiIf you want to know deep knowledge then click here and get more information about itext pdf program.http://www.roseindia.net/java 

Java Beginners

Read Issue itext
is der any way to read line by line data using itext so dat i can process it manually afterwords.. thnx in advance Rohit   Java itext read pdf file...Read Issue itext  Hello, I m using itext to read data from pdf file 

Java Beginners

Read Issue itext
is der any way to read line by line data using itext so dat i can process it manually afterwords.. thnx in advance Rohit   Java itext read pdf file...Read Issue itext  Hello, I m using itext to read data from pdf file 

Java Beginners

itext - Java Beginners
itext  Hi, Can we add contents to the back side of an itext pdf.For example to add copyright info on the back of the card .  Hi.../java/itext.shtml 

Java-Tutorials

Examples of iText
Examples of iText      ... or not.      itext chunk In this free tutorial we are going to tell you about chunk in iTextiText 

Java Beginners

index of javaprogram
index of javaprogram  what is the step of learning java. i am not asking syllabus am i am asking the step of program to teach a pesonal student.   To learn java, please visit the following link: Java Tutorial 

Java Code Examples

itext chunk
itext chunk       In this free tutorial we are going to tell you about chunk in iTextiText is a framework for creating pdf files in java. A Chunk 

JSP Servlet Questions

hyperlink
hyperlink  I have a .xls file and i want the code to open this .xls file in read only mode when i click on a hyperlink,it should not not be editable,please send me the code 

JSP Servlet Questions

hyperlink - JSP-Servlet
hyperlink  Hi! I am displaying bulk data in my page. It looks like some what senseless. Thats why I want to put a small link after two lines that is "more..." if user clicks on that link he will get entire data. I am not getting 

General

Find String Values of Cell Using POI
Find String Values of Cell Using POI   ... Values of Cell of  an excel sheet using POI3.0 API Event. The class ...: getSSTIndex(): The method is used to get the index to the string in the SSTRecord 

Java Beginners

Java read entire file into byte array
Java read entire file into byte array  Where is the example of Java read entire file into byte array on your website? Thanks   Hi, Its simple you can use insputStream.read(bytes); method of InputStream class. Read 

JSP Servlet Questions

Hyperlink
 

Java Beginners

generating itext pdf from java application - Java Beginners
generating itext pdf from java application  hi, Is there any method in page events of itext to remove page numbers from pdf generated frm.../java/itext/index.shtml 

Java Beginners

Displaying html code in pdf with itext - Java Beginners
Displaying html code in pdf with itext   Hi , I am geeting data which was enterd from fck editor. same data is stored in the database i need to display this data in the pdf . i am using itext to create 

Java Beginners

index - Java Beginners
index  Hi could you pls help me with this two programs they go hand in hand. Write a Java GUI application called Index.java that inputs several... the number of occurrences of the character in the text. Write a Java GUI 

Java Interview Questions

How to ensure the same output by java code on 32 bit m/c and 64 bit m/c
How to ensure the same output by java code on 32 bit m/c and 64 bit m/c  How to ensure the same output by java code on 32 bit m/c and 64 bit m/c 

General

Java arraylist index() Function
Java arrayList has index for each added element. This index starts from 0. arrayList values can be retrieved by the get(index) method. Example of Java Arraylist Index() Function import 

Swing AWT

How to delete and update from Jtable cell in swing app
How to delete and update from Jtable cell in swing app  Hii Sir... that the column exists (index > 0 && index < number of columns... { // The driver allows you to query the database with Java // forName 

AOP Questions

page break using itext in java column wise
page break using itext in java column wise  I have a itext report which will displays n number of idcodes which will display from db.But in the pdf it has certain limits showing these codes in one page. So all the datas 

Java-Tutorials

Setting Cell Values in JTable
_index, int col_index): This method is used to set the given value in a cell... Setting Cell Values in JTable       In this section, we will learn how to set the cell 

Java Beginners

insert checkbox in cell using POI api in java
insert checkbox in cell using POI api in java  I need to insert checkbox in excel cell using POI and java. Any one help me on this. Ashok S 

JSP Servlet Questions

Passing td cell id to servlet
Passing td cell id to servlet  Hi all, I am new to JSP/Servlet .Please help. I need to send the table cell index in servlet using javascript and should be able to make a cell index to have a text - "X" / "0"only once. Here 

Blog

Site map Index
applications, mobile applications, batch processing applications. Java is used... | Linux Tutorial  | Java Script Tutorial | PHP Tutorial | Java Servlet Tutorial  | Java Swing Tutorial | JEE 5 Tutorial  | JDBC 

Swing AWT

JTable - Cell selection - Swing AWT
JTable - Cell selection  How to select a cell of a JTable when I clicked a button?  Hi friend, import java.awt.*; import... information. http://www.roseindia.net/java/example/java/swing/ Thanks. Amardeep 

Java Beginners

including index in java regular expression
including index in java regular expression  Hi, I am using java regular expression to merge using underscore consecutive capatalized words e.g., "New York" (after merging "New_York") or words that has accented characters 

Swing AWT

JTable Cell Validation? - Swing AWT
JTable Cell Validation?  hi there please i want a simple example... or leave the cell empty nothing happens(the value still as it was) thank you all ...://www.roseindia.net/java/example/java/swing/ Thanks  it's not exactly 

Java Beginners

Auto fit the MS Excel cell width
Auto fit the MS Excel cell width  I am writing string in ms excel sheet via java code . Cell width is very large, and I want to auto fit the width of cell via java. Kindly help me as soon as possible. Its very urgent 

HTML Questions

how to show hyperlink website on the same page
how to show hyperlink website on the same page  dear sir: i need... www.roseindia.net by clicking on roseindia in hyperlink that will be displayed...; <body bgcolor="lightBlue"> <h2>Java Tutorial</h2> < 

Java Beginners

How to set iText pdf document background image - Java Beginners
://www.roseindia.net/java/itext/backgroundColorPDF.shtml Thanks...How to set iText pdf document background image  Hi, I have created the pdf document using the iText classes. but i need to set the background 

XML Questions

creating index for xml files - XML
creating index for xml files  I would like to create an index file... after another and then retrieve each tag and create index to that file. In some cases, more than one file may have same name. So, my index file would be like 

IDE Questions

ChapterAuonumber Itext
ChapterAuonumber Itext  I'm new to Itext ,Please provide some example of using ChapterAutonumber in Itext 

JSP Servlet Questions

Get specific item details by clicking on hyperlink
and corresponding image with a hyperlink on it from the database to a jsp page. -If I click...]; InputStream readImg = rs.getBinaryStream(1); int index=readImg.read(rb, 0, len 

Java Beginners

How to extract the entire line with specific data from a Text in java?
How to extract the entire line with specific data from a Text in java?  Hi, i would like to extract data from text like the following one: [CODE... of them don't contain number. in Java what method or function could i use to do 

General

Free Java Apps for cell phones
Free Java Apps for cell phones       Here you will find free java apps for cell phones and other mobile... java apps for cell phones: Azure Azure is very useful blog client written in J2ME 

JSP Interview Questions

enable hyperlink
enable hyperlink  How to enable hyperlink 

Swing AWT

Query on Java Swing - Table Cell Issue - Swing AWT
Query on Java Swing - Table Cell Issue  Hi, I have a query on Java... the key board focus is moving from one cell to another table cell but I am unable to show the cursor in the focused cell which is editable. what do I need do 

General

Add Content of an iText PDF File using java code
Add Content of an iText PDF File using java code  ... documents from Java program. The iText is a open source library that provide facility to create pdf file from java application. iText is a freely available Java 

Java Interview Questions

How to index a given paragraph in alphabetical order
How to index a given paragraph in alphabetical order  Write a java program to index a given paragraph. Paragraph should be obtained during runtime... paragraph : This is a technical round. Please index the given paragraph. Output 

General

Index Out of Bound Exception
Index Out of Bound Exception       Index Out of Bound Exception  are the Unchecked Exception... passed to a method in a code. The java Compiler does not check the error during 

Java-Tutorials

Create a Custom Cell Renderer in a JTable
a custom cell renderer in a JTable to use some Java methods and APIs. Description... Create a Custom Cell Renderer in a JTable   ... cell renderer in a JTable component. Here, first of all you will know about 

Java-Tutorials

Enabling Row, Column and Cell Selections in a JTable
select any cell of a JTable, the entire row is selected that means enabling row... property to the row, if you select any cell of a table, the entire row... Enabling Row, Column and Cell Selections in a JTable 

Java Server Faces Questions

Displaying the entire row in another datatable when the checkbox is checked - Java Server Faces Questions
Displaying the entire row in another datatable when the checkbox is checked  Dear Sir, I have a jsf datatable which has 8 columns. I need... the entire row in another datatable.Please tell me the sample code. Thanks 

Java Beginners

How to insert a single page PDF file into another multipage PDF file using iText? - Java Beginners
How to insert a single page PDF file into another multipage PDF file using iText?  Hi ALL: I have two PDF files. PDF-A.pdf is a multipage PDF file. PDF-B.pdf is a single page PDF file. I want to insert PDF-B into PDF-A only 

Java-Tutorials

Format Cell of Simple Excel Sheet(.xls)
Format Cell of Simple Excel  Sheet(.xls) In this section, you will how to format the cell of a simple excel sheet having extension .xls. In the below example, we will create second cell of first row having applied style 

JSP Servlet Questions

passing values between jsp file through hyperlink in div tag
passing values between jsp file through hyperlink in div tag  <p>hi please help me to solve this. i have searchproj.jsp and updateproj.jsp....;%@ page language="java"%&gt; &lt;%@ page import ="java.sql.*"%& 

Programming Tutorials

Write a byte into byte buffer at given index.
Write a byte into byte buffer at given index.  In this tutorial, we...; index. ByteBuffer API: The java.nio.ByteBuffer class extends... ByteBuffer putChar(int index, byte b) The putChar(..) method write 

Java Beginners

How to access the image file from project folder itself while writing to pdf using itext?
How to access the image file from project folder itself while writing to pdf using itext?  I am writing a pdf using itext where i add a image... accomplish this.I am using simple java program to write the pdf.Not a servlet.Thanks 

Programming Tutorials

Write a int value into int buffer at given index.
Write a int value into int buffer at given index.  In this tutorial, we...;index. IntBuffer API: The java.nio.IntBuffer class extends.... abstract  InttBuffer put(int index, int value) The put(..) method write 

Programming Tutorials

Write a float value into float buffer at given index.
;} } Output C:\>java PutIndexValue Store value at index : 3...Write a float value into float buffer at given index.  In this tutorial...;given index. FloatBuffer API: The java.nio.FloatBuffer class extends 

SQL Question

What is Index?
What is Index?  What is Index 

Java Beginners

Adding images in itext pdf
Adding images in itext pdf  Hi, How to add image in pdf file using itext? Thanks   Hi, You can use following code: PdfWriter.getInstance(document,new FileOutputStream("imagesPDF.pdf")); Read more at Inserting 

HTML Questions

differences between cell spacing and cell padding
differences between cell spacing and cell padding  What are the differences between cell spacing and cell padding 

Programming Tutorials

Write a long value at given index into long buffer.
Write a long value at given index into long buffer.  In this tutorial, we will see how to write a long value at given index into long buffer.... abstract  LongBuffer put(int index, long value) The put(..) method 

Mobile Applications Questions

iText support android? - MobileApplications
iText support android?   would iText support android? i ve linked the iText.jar file with my android project developed in eclipse... //code Document document = new Document(PageSize.A4, 50, 50, 50, 50 

JavaScript Questions

email entire page javascript
email entire page javascript  How to email entire page in JavaScript without using OB?   ob_end_start(); // page content if(!empty($_GET['purpose']) && $_GET['purpose'] == "email") { $message = ob_get 

HTML Questions

Redirect Entire Frame
Redirect Entire Frame  Hello All:) I ve 2 frames in a html file. Say Header and Trailer. I ve a link to logout. When i click on logout.... Any one have idea how i can redirect the entire header and trailer? What i can do 

Mobile Applications Questions

Hyperlink on UILabel iPhone SDK
Hyperlink on UILabel iPhone SDK  Hi, I wanted to set a hyperlink on UILabel in my iPhone application. Can anyone suggest me how to do it? Thanks 

Struts 2 Tutorials

OGNL Index
is a expression language. It is used for getting and setting the properties of java object... properties of java object. It has own syntax, which is very simple. It make..., this first character at 0 index is extracted from the resulting array 

Programming Tutorials

How to get given index value from FloatBuffer in java.
How to get given index value from FloatBuffer in java.  In this tutorial, we will discuss how to get given index value from FloatBuffer in java.... abstract float get(int index) The get(...) method returns float value 

Programming Tutorials

How to get specific index value from ByteBuffer in java.
How to get specific index value from ByteBuffer in java.    ... will discuss how to get value of a given index from buffer. The ByteBuffer class is a container for handling data. The get(int index) method of ByteBuffer 

JSP Servlet Questions

Expand and collapse for the entire form
Expand and collapse for the entire form  i have a jsp with multiple sections. i have implemented expand and collapse for all the sections. now i want to do the same for the page itself. i mean, when the page gets loaded al 

JSP Interview Questions

how to get multiple hyperlink values from a table column to another jsp file?
how to get multiple hyperlink values from a table column to another jsp file... file named "index" asks the user to enter the itemid and and search for it. second file named "dbtable" will get the parameter from "index" and search 

JSP Servlet Questions

passing values in hyperlink
passing values in hyperlink  Hi. I have given a hyperlink in one jsp page. Can i able to pass that hyperlink label as a value to the next page its navigating when the user clicks it. Plz respond me quickly. Thanks in advance 

JSP Servlet Questions

passing values in hyperlink
passing values in hyperlink  Hi. I have given a hyperlink in one jsp page. Can i able to pass that hyperlink label as a value to the next page its navigating when the user clicks it. Plz respond me quickly. Thanks in advance 

JSP Servlet Questions

passing values in hyperlink
passing values in hyperlink  Hi. I have given a hyperlink in one jsp page. Can i able to pass that hyperlink label as a value to the next page its navigating when the user clicks it. Plz respond me quickly. Thanks in advance 

JSP Servlet Questions

passing values in hyperlink
passing values in hyperlink  Hi. I have given a hyperlink in one jsp page. Can i able to pass that hyperlink label as a value to the next page its navigating when the user clicks it. Plz respond me quickly. Thanks in advance 

JSP Servlet Questions

passing values in hyperlink
passing values in hyperlink  Hi. I have given a hyperlink in one jsp page. Can i able to pass that hyperlink label as a value to the next page its navigating when the user clicks it. Plz respond me quickly. Thanks in advance 

JSP Servlet Questions

eclips hyperlink - JSP-Servlet
eclips hyperlink  In my myeclipse if hyperlink is provided in any application , it's not working when I deploy it. I also use net at my PC, is there any problem due to IP Address 

Java Beginners

change content of cell javascript
change content of cell javascript  change content of cell javascript 

Programming Tutorials

ShortBuffer in java, Write a short value into short buffer at given index.
Write a short value into short buffer at given index.  In this tutorial...;given index. ShortBuffer API: The java.nio.ShortBuffer class extends...; ShortBuffer put(int index, short value) The put(..) method write the given 

Servlet Interview Questions

Call a servlet on click of hyperlink
Call a servlet on click of hyperlink  Call a servlet on click of hyperlink   . request.getContextPath() is used to return...; </head> <body> <h2>Click on bellow hyperlink 

Programming Tutorials

How to get specific index value from int buffer.
;intBuf.get(index));   } } Output C:>java...How to get specific index value from int buffer. In this tutorial, we will discuss how  to get specific index value from int buffer. IntBuffer 

Mobile Applications Questions

Custom Cell View UITableview
Custom Cell View UITableview  How can i get two custom cell view in UITableView 

Programming Tutorials

How to get specific index value from short buffer.
How to get specific index value from short buffer. In this tutorial, we will discuss how  to get specific index value from short buffer. ShortBuffer...; abstract short get( int index) The get() method reads is short 

Programming Tutorials

How to get specific index value from long buffer.
How to get specific index value from long buffer. In this tutorial, we will discuss how  to get specific index value from long buffer. LongBuffer...; long get(int index) The get() method read long value at given 

Java Beginners

Search index
 

IDE Questions

filling pdf by itext
 

JSP Servlet Questions

use data from database as hyperlink and pass the data in the hyperlink
use data from database as hyperlink and pass the data in the hyperlink  Hi Friends, I am using the data from database as hyperlink and pass the data as a parameter in the hyperlink to a servlet page. By using display table 

JDBC Questions

editing cell in a table - JDBC
editing cell in a table  how can i edit a cell in a table and save the change to a database  Hi Friend, Try the following code: 1)updateDatabase.jsp RollNo Name Class "> "> "> 

Programming Tutorials

Drop Index
Drop Index       Drop Index is used to remove one or more indexes from the current database. Understand with Example The Tutorial illustrate an example from Drop Index 

GWT

Creating Hyperlink using GWT
Creating Hyperlink using GWT       This example describes the Basics for building the Hyperlink using GWT. The steps involved in Building the Hyperlink are described below 

PHP Questions

retrieve data from database with hyperlink
retrieve data from database with hyperlink  sir....i have one table called 'name' having two values i have to retrieve those data with a hyperlink and show in browser and if we click hyperlink its shows his sub categories....how 

HTML Questions

css table cell margin
css table cell margin  How can i put margin between two columns(cell margin)?   In your CSS you can set the desired margin between two cells as given below.. padding-right:10px;   now you need to call 

Mobile Applications Questions

Height for cell in table view - UITableView
Height for cell in table view - UITableView  UITableview height for cell What is the height for cell in table view iPhone mobile application 

Java Beginners

Display of value in Tabel cell
in the table cell by defining the cell editor.The cell is having a text field and calendar.When i select a date in the calendar the date will be displayed in the cell...) The format the cell is showing when its in focus - Mon,dd,yyyy(Mar,01,2011). I 

SQL Question

clustered and a non-clustered index?
clustered and a non-clustered index?  What is the difference between clustered and a non-clustered index 

JSP Servlet Questions

image on div or cell of table
image on div or cell of table  I am using ms access database and I have stored the image in access database and I have a code to display image but it display on browser but I want to display on inside the div tag or table tag pls 

JSP Servlet Questions

image on div or cell of table
image on div or cell of table  I am using ms access database and I have stored the image in access database and I have a code to display image but it display on browser but I want to display on inside the div tag or table tag pls 

JSP Servlet Questions

image on div or cell of table
image on div or cell of table  I am using ms access database and I have stored the image in access database and I have a code to display image but it display on browser but I want to display on inside the div tag or table tag pls 

JSP Servlet Questions

image on div or cell of table
image on div or cell of table  I am using ms access database and I have stored the image in access database and I have a code to display image but it display on browser but I want to display on inside the div tag or table tag pls 

JSP Servlet Questions

image on div or cell of table
image on div or cell of table  I am using ms access database and I have stored the image in access database and I have a code to display image but it display on browser but I want to display on inside the div tag or table tag pls 

JSP Servlet Questions

image on div or cell of table
image on div or cell of table  I am using ms access database and I have stored the image in access database and I have a code to display image but it display on browser but I want to display on inside the div tag or table tag pls 

Advertisements Advertisements
 

 

 

DMCA.com