Top 26 Apache Poi Ppt Interview Questions
Q1. What Is The Purpose Of Xssfworkbook Class In Apache Poi?
It is a class that is used to represent each high and coffee level Excel file formats. It belongs to the org.Apache.Xssf.Usemodel package deal and implements the Workbook interface.
Q2. How Will You Add A Hyperlink To A Cell Using Apache Poi?
XSSFHyperlink may be used to the add an hyperlink to a mobile.
CreationHelper createHelper = workbook.GetCreationHelper();
XSSFHyperlink hyperlink = (XSSFHyperlink)createHelper.CreateHyperlink(Hyperlink.LINK_URL);
link.SetAddress("http://www.Tutorialspoint.Com/" );
cellular.SetHyperlink((XSSFHyperlink) link);
Q3. How Will You Style A Cell Using Apache Poi?
XSSFCellStyle elegance is used to style a mobile. Following code snippet can be used to set the cellular alignment to "Top Left".
XSSFCellStyle style1 = workbook.CreateCellStyle();
spreadsheet.SetColumnWidth(zero, 8000);
style1.SetAlignment(XSSFCellStyle.ALIGN_LEFT);
style1.SetVerticalAlignment(XSSFCellStyle.VERTICAL_TOP);
cell.SetCellValue("Top Left");
mobile.SetCellStyle(style1);
Q4. What Is The Purpose Of Hssfcolor Class In Apache Poi?
This is a class below the org.Apache.Poi.Hssf.Util package deal. It presents extraordinary colorations as nested instructions. Usually those nested training are represented by way of using their very own indexes. It implements the Color interface.
Q5. How Will You Rotate A Cell Content Using Apache Poi?
XSSFCellStyle class can be used to rotate a mobile. Following code snippet may be used to set the cellular textual content alignment to a distinct perspective.
//ninety degrees
XSSFCellStyle myStyle = workbook.CreateCellStyle();
myStyle.SetRotation((brief) ninety);
cellular = row.CreateCell(five);
mobile.SetCellValue("90D perspective");
mobile.SetCellStyle(myStyle);
Q6. What Is The Purpose Of Xssfhyperlink Class In Apache Poi?
This is a category under the org.Apache.Poi.Xssf.Usermodel package. It implements the Hyperlink interface. It is used to set a link to the cellular contents of a spreadsheet.
Q7. How Will You Add A Power Formular To A Cell Using Apache Poi?
XSSFCell.CELL_TYPE_FORMULA can be used to the mobile as method cell.
// Create SUM system
cell.SetCellType(XSSFCell.CELL_TYPE_FORMULA);
cell.SetCellFormula("POWER(C2:C3)" );
cell = row.CreateCell(three);
cell.SetCellValue("POWER(C2:C3)");
Q8. What Is The Purpose Of Xssffont Class In Apache Poi?
This is a class beneath the org.Apache.Poi.Xssf.Usermodel package deal. It implements the Font interface and therefore it can handle one-of-a-kind fonts in a workbook.
Q9. How Will You Add A Sqrt Formular To A Cell Using Apache Poi?
XSSFCell.CELL_TYPE_FORMULA may be used to the cell as components cell.
// Create SUM system
cellular.SetCellType(XSSFCell.CELL_TYPE_FORMULA);
mobile.SetCellFormula("SQRT(C2)" );
cellular = row.CreateCell(3);
cell.SetCellValue("SQRT(C2)");
Q10. What Is The Purpose Of Xssfcell Class In Apache Poi?
This is a class underneath the org.Apache.Poi.Xssf.Usermodel package deal. It implements the Cell interface. It is a high-level illustration of cells within the rows of a spreadsheet.
Q11. Write Down Steps To Create A Cell In A Spreadsheet In Apache Poi?
The following code snippet is used for creating a mobile:
//create new workbook
XSSFWorkbook workbook = new XSSFWorkbook();
//create spreadsheet with a call
XSSFSheet spreadsheet = workbook.CreateSheet("new sheet");
//create first row on a created spreadsheet
XSSFRow row = spreadsheet.CreateRow(zero);
//create first mobile on created row
XSSFCell cellular = row.CreateCell(zero);
Q12. What Is The Purpose Of Xssfsheet Class In Apache Poi?
This is a category which represents high level representation of excel spreadsheet. It is underneath org.Apache.Poi.Hssf.Usermodel package deal.
Q13. How Will You Add A Max Formular To A Cell Using Apache Poi?
XSSFCell.CELL_TYPE_FORMULA can be used to the cellular as components cellular.
// Create SUM components
cellular.SetCellType(XSSFCell.CELL_TYPE_FORMULA);
mobile.SetCellFormula("MAX(C2:C3)" );
mobile = row.CreateCell(3);
cellular.SetCellValue("MAX(C2:C3)");
Q14. What Is The Purpose Of Xssfrow Class In Apache Poi?
This is a class beneath the org.Apache.Poi.Xssf.Usermodel bundle. It implements the Row interface, consequently it is able to create rows in a spreadsheet.
Q15. What Is The Purpose Of Xssfprintsetup Class In Apache Poi?
This is a class underneath the org.Apache.Poi.Xsssf.Usermodel package. It implements the PrintSetup interface. It is used to set print page size, area, options, and settings.
Q16. How Will You Add A Sum Formular To A Cell Using Apache Poi?
XSSFCell.CELL_TYPE_FORMULA may be used to the mobile as formulation cell.
// Create SUM components
mobile.SetCellType(XSSFCell.CELL_TYPE_FORMULA);
cellular.SetCellFormula("SUM(C2:C3)" );
cell = row.CreateCell(three);
cellular.SetCellValue("SUM(C2:C3)");
Q17. How Will You Set The Printable Area Of An Excel Using Apache Poi?
Following code snippet display putting in the printable vicinity of an excel the usage of Apache POI.
XSSFWorkbook workbook = new XSSFWorkbook();
XSSFSheet spreadsheet = workbook
.CreateSheet("Print Area");
//set print region with indexes
workbook.SetPrintArea(
0, //sheet index
zero, //start column
5, //quit column
0, //start row
five //stop row
);
//set paper size
spreadsheet.GetPrintSetup().SetPaperSize(
XSSFPrintSetup.A4_PAPERSIZE);
//set display grid traces or not
spreadsheet.SetDisplayGridlines(true);
//set print grid lines or no longer
spreadsheet.SetPrintGridlines(proper);
Q18. Name Some Of The Components Of Apache Poi?
Components of Apache POI:
Apache POI includes instructions and techniques to work on all OLE2 Compound documents of MS Office. The listing of additives of this API is given underneath.
POIFS (Poor Obfuscation Implementation File System) − This thing is the basic element of all other POI factors. It is used to examine distinct documents explicitly.
HSSF (Horrible Spreadsheet Format): It is used to examine and write xls format of MS-Excel files.
XSSF (XML Spreadsheet Format): It is used for xlsx document format of MS-Excel.
HPSF (Horrible Property Set Format): It is used to extract assets units of the MS-Office files.
HWPF (Horrible Word Processor Format): It is used to examine and write doc extension files of MS-Word.
XWPF (XML Word Processor Format): It is used to study and write docx extension documents of MS-Word.
HSLF (Horrible Slide Layout Format): It is used for read, create, and edit PowerPoint displays.
HDGF (Horrible DiaGram Format): It carries instructions and techniques for MS-Visio binary documents.
HPBF (Horrible PuBlisher Format): It is used to examine and write MS-Publisher documents.
Q19. What Is The Purpose Of Xssfcreationhelper Class In Apache Poi?
This is a class beneath the org.Apache.Poi.Xssf.Usermodel package deal. It implements the CreationHelper interface. It is used as a aid elegance for system evaluation and putting in place links.
Q20. What Is The Purpose Of Hssfsheet Class In Apache Poi?
This is a category below the org.Apache.Poi.Hssf.Usermodel package deal. It can create excel spreadsheets and it lets in to format the sheet style and sheet facts.
Q21. How Will You Add A Fact Formular To A Cell Using Apache Poi?
XSSFCell.CELL_TYPE_FORMULA can be used to the cellular as system mobile.
// Create SUM system
cellular.SetCellType(XSSFCell.CELL_TYPE_FORMULA);
cellular.SetCellFormula("FACT(C2)" );
mobile = row.CreateCell(three);
cellular.SetCellValue("FACT(C2)");
Q22. How Will You Add A Font To A Cell Using Apache Poi?
XSSFFont magnificence is used to add a font to a cell. Following code snippet can be used to set the heritage shade of a mobile to "Green".
//Create a brand new font and alter it.
XSSFFont font = workbook.CreateFont();
font.SetFontHeightInPoints((quick) 30);
font.SetFontName("IMPACT");
font.SetItalic(real);
font.SetColor(HSSFColor.BRIGHT_GREEN.Index);
//Set font into style
XSSFCellStyle style = workbook.CreateCellStyle();
style.SetFont(font);
Q23. What Is The Purpose Of Xssfcellstyle Class In Apache Poi?
This is a class beneath the org.Apache.Poi.Xssf.Usermodel bundle. It will offer feasible statistics regarding the layout of the content material in a cellular of a spreadsheet. It additionally gives options for modifying that format. It implements the CellStyle interface.
Q24. Write Down Steps To Create A Spreadsheet In Apache Poi?
The following code snippet is used to create a spreadsheet:
//Create Blank workbook
XSSFWorkbook workbook = new XSSFWorkbook();
//Create a clean spreadsheet
XSSFSheet spreadsheet = workbook.CreateSheet("Sheet Name");
Write down steps to create a row in a spreadsheet in Apache POI.
The following code snippet is used to create a row.
XSSFRow row = spreadsheet.CreateRow((brief)1);
Q25. What Is The Purpose Of Hssfworkbook Class In Apache Poi?
It is a high-degree magnificence below the org.Apache.Poi.Hssf.Usermodel bundle. It implements the Workbook interface and is used for Excel documents in .Xls format.
Q26. What Is Apache Poi?
Apache POI is a popular API that permits programmers to create, regulate, and show MS Office documents using Java applications. It is an open supply library advanced and distributed by using Apache Software Foundation to layout or adjust Microsoft Office documents the use of Java program. It carries classes and techniques to decode the person enter data or a document into MS Office documents.

