当前位置: 首页>>代码示例>>Java>>正文


Java HyperlinkType类代码示例

本文整理汇总了Java中org.apache.poi.common.usermodel.HyperlinkType的典型用法代码示例。如果您正苦于以下问题:Java HyperlinkType类的具体用法?Java HyperlinkType怎么用?Java HyperlinkType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


HyperlinkType类属于org.apache.poi.common.usermodel包,在下文中一共展示了HyperlinkType类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setHyperlink

import org.apache.poi.common.usermodel.HyperlinkType; //导入依赖的package包/类
/**
 * セルにハイパーリンクを設定する。
 * 
 * @param cell セル
 * @param type リンクタイプ
 * @param address ハイパーリンクアドレス
 * @see org.apache.poi.common.usermodel.Hyperlink
 */
public static void setHyperlink( Cell cell, HyperlinkType hyperlinkType, String address) {

    Workbook wb = cell.getRow().getSheet().getWorkbook();

    CreationHelper createHelper = wb.getCreationHelper();

    Hyperlink link = createHelper.createHyperlink( hyperlinkType);
    if ( link instanceof HSSFHyperlink) {
        (( HSSFHyperlink) link).setTextMark( address);
    } else if ( link instanceof XSSFHyperlink) {
        (( XSSFHyperlink) link).setAddress( address);
    }

    cell.setHyperlink( link);
}
 
开发者ID:excella-core,项目名称:excella-core,代码行数:24,代码来源:PoiUtil.java

示例2: testAddRow

import org.apache.poi.common.usermodel.HyperlinkType; //导入依赖的package包/类
@SuppressWarnings("resource")
@Test
public void testAddRow() {
  Calendar cal = Calendar.getInstance();
  Date date = new Date();
  writer.addRow("def");
  writer
      .addRow(null, true, cal, date, 1.1, new HSSFRichTextString("Hello!"),
          new XSSFRichTextString("World."), new HSSFWorkbook()
              .getCreationHelper().createHyperlink(HyperlinkType.URL),
          123, "abc");
  assertEquals("def", writer.getWorkbook().getSheetAt(0).rowIterator().next()
      .cellIterator().next().getStringCellValue());
  WorkbookWriter.openXLSX().addRow(new HSSFRichTextString("Hello!"),
      new XSSFRichTextString("World."));
  WorkbookWriter.openXLS().addRow(new HSSFRichTextString("Hello!"),
      new XSSFRichTextString("World."));

}
 
开发者ID:wnameless,项目名称:workbook-accessor,代码行数:20,代码来源:WorkbookWriterTest.java

示例3: writeWorkbook

import org.apache.poi.common.usermodel.HyperlinkType; //导入依赖的package包/类
private void writeWorkbook() throws java.io.IOException {
    Workbook wb = new XSSFWorkbook();
    try {
        Sheet sheet = wb.createSheet("Sheet1");
        Row row = sheet.createRow(0);
        Cell cell = row.createCell(0);
        cell.setCellValue("cell-1");
        cell = row.createCell(1);
        cell.setCellValue("cell-2");
        cell = row.createCell(2);
        cell.setCellValue("cell-3");

        XSSFCellStyle style = (XSSFCellStyle) wb.createCellStyle();
        style.setFillBackgroundColor(new XSSFColor(new org.apache.poi.java.awt.Color(1, 2, 3)));

        Hyperlink link = wb.getCreationHelper().createHyperlink(HyperlinkType.URL);
        link.setAddress("http://www.google.at");
        link.setLabel("Google");
        cell.setHyperlink(link);

        cell.setCellStyle(style);

        sheet.setPrintGridlines(true);

        OutputStream stream = openFileOutput("test.xlsx", Context.MODE_PRIVATE);
        try {
            wb.write(stream);
        } finally {
            stream.close();
        }
    } finally {
        wb.close();
    }
}
 
开发者ID:centic9,项目名称:poi-on-android,代码行数:35,代码来源:DocumentListActivity.java

示例4: setAttachmentURLLinks

import org.apache.poi.common.usermodel.HyperlinkType; //导入依赖的package包/类
private Hyperlink setAttachmentURLLinks(SignupAttachment attach) {
	Hyperlink hsHyperlink = wb.getCreationHelper().createHyperlink(HyperlinkType.URL);
	String link = this.sakaiFacade.getServerConfigurationService().getServerUrl()
			+ attach.getLocation();
	hsHyperlink.setAddress(link);
	hsHyperlink.setLabel(attach.getFilename());
	return hsHyperlink;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:9,代码来源:EventWorksheet.java

示例5: addReportSheet

import org.apache.poi.common.usermodel.HyperlinkType; //导入依赖的package包/类
private void addReportSheet(final Workbook workbook) {
    final Sheet reportSheet = workbook.createSheet("Report");
    final CreationHelper creationHelper = workbook.getCreationHelper();

    final int PCODE_COL_NUM = 0;
    final int INCIDENT_COL_NUM = 1;
    final int DATASET_IMPORT_STATUS = 2;
    final int SUPPORTING_DATA_DESC_COL_NUM = 3;
    final int SUPPORTING_DATA_VALUES_COL_NUM = 4;
    final int DATASET_TITLE_COL_NUM = 5;

    final CellStyle headerCellStyle = workbook.createCellStyle();
    final Font headerFont = workbook.createFont();
    headerFont.setBold(true);
    headerCellStyle.setFont(headerFont);
    headerCellStyle.setAlignment(HorizontalAlignment.CENTER);
    headerCellStyle.setVerticalAlignment(VerticalAlignment.TOP);
    headerCellStyle.setFillBackgroundColor(IndexedColors.GREY_40_PERCENT.getIndex());

    final CellStyle labelValueCellStyle = workbook.createCellStyle();
    labelValueCellStyle.setAlignment(RIGHT);


    final AtomicInteger rowNum = new AtomicInteger(0);

    final Row headersRow = reportSheet.createRow(rowNum.getAndAdd(1));
    int headerColumnNum = PCODE_COL_NUM;
    addCell(headersRow, headerColumnNum++, "P-code", headerCellStyle);
    addCell(headersRow, headerColumnNum++, "Incident", headerCellStyle);
    addCell(headersRow, headerColumnNum++, "Impact on\nDataset migration", headerCellStyle);

    addCell(headersRow, headerColumnNum++, "Incident Data Description", headerCellStyle);
    addCell(headersRow, headerColumnNum++, "Incident Data", headerCellStyle);

    addCell(headersRow, headerColumnNum++, "Indicator", headerCellStyle);

    incidentLogEntries.forEach(logEntry -> {
        final Row row = reportSheet.createRow(rowNum.getAndAdd(1));

        int valueColumnNum = 0;

        final Cell pCodeCell = addCell(row, valueColumnNum++, logEntry.getPCode());
        final Hyperlink pCodeHyperlink = creationHelper.createHyperlink(HyperlinkType.URL);
        pCodeHyperlink.setAddress(
            "https://indicators.hscic.gov.uk/webview/velocity?v=2&mode=documentation&submode=ddi&study=http%3A%2F%2F192.168.229.22%3A80%2Fobj%2FfStudy%2F"
                + logEntry.getPCode()
        );
        pCodeCell.setHyperlink(pCodeHyperlink);

        addCell(row, valueColumnNum++, logEntry.getIncidentType().getDescription());
        addCell(row, valueColumnNum++, logEntry.getIncidentType().getDatasetMigrationImpact().getDescription());
        addCell(row, valueColumnNum++, logEntry.getIncidentType().getSupportingDataDescription() +
                (isBlank(logEntry.getIncidentType().getSupportingDataDescription()) ? "" : ":"),
            labelValueCellStyle
        );
        addCell(row, valueColumnNum++, logEntry.getSupportingData().stream().collect(joining("\n")));
        addCell(row, valueColumnNum++, datasetRepository.findById(logEntry.getPCode()).getTitle());
    });

    reportSheet.autoSizeColumn(PCODE_COL_NUM);
    reportSheet.autoSizeColumn(INCIDENT_COL_NUM);
    reportSheet.autoSizeColumn(DATASET_IMPORT_STATUS);
    reportSheet.autoSizeColumn(SUPPORTING_DATA_DESC_COL_NUM);
    reportSheet.autoSizeColumn(SUPPORTING_DATA_VALUES_COL_NUM);
    reportSheet.autoSizeColumn(DATASET_TITLE_COL_NUM);
}
 
开发者ID:NHS-digital-website,项目名称:hippo,代码行数:67,代码来源:MigrationReport.java

示例6: parseHyperlinkVariale

import org.apache.poi.common.usermodel.HyperlinkType; //导入依赖的package包/类
private static Optional<PptVariable> parseHyperlinkVariale(Hyperlink<?, ?> link) {
	if(link != null && link.getTypeEnum() == HyperlinkType.URL) {
		return PptParser.parse(link.getAddress());
	}
	return Optional.empty();
}
 
开发者ID:Coreoz,项目名称:PPT-Templates,代码行数:7,代码来源:PptTemplates.java


注:本文中的org.apache.poi.common.usermodel.HyperlinkType类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。