public DmnModelInstance convert(InputStream inputStream) {
    SpreadsheetMLPackage spreadSheetPackage = null;
    try {
      spreadSheetPackage = SpreadsheetMLPackage.load(inputStream);
    } catch (Docx4JException e) {
      // TODO: checked exception
      throw new RuntimeException("cannot load document", e);
    }
    WorkbookPart workbookPart = spreadSheetPackage.getWorkbookPart();
    // TODO: exception when no worksheet present
    // TODO: make worksheet number configurable/import all worksheets?
    XlsxWorksheetContext worksheetContext = null;
    WorksheetPart worksheetPart;
    try {
      String worksheetName;
      DocPropsExtendedPart docPropsExtendedPart = spreadSheetPackage.getDocPropsExtendedPart();
      if(docPropsExtendedPart!= null && docPropsExtendedPart.getContents().getTitlesOfParts() != null) {
        worksheetName = (String) docPropsExtendedPart.getContents().getTitlesOfParts().getVector().getVariantOrI1OrI2().get(0).getValue();
      } else {
        worksheetName = "default";
      }
      worksheetPart = workbookPart.getWorksheet(0);
      SharedStrings sharedStrings = workbookPart.getSharedStrings();
      worksheetContext = new XlsxWorksheetContext(sharedStrings.getContents(), worksheetPart.getContents(), worksheetName);
    } catch (Exception e) {
      throw new RuntimeException("Could not determine worksheet", e);
    }
    return new XlsxWorksheetConverter(worksheetContext, ioDetectionStrategy).convert();
  }
public DmnModelInstance convert(InputStream inputStream) {
    SpreadsheetMLPackage spreadSheetPackage = null;
    try {
      spreadSheetPackage = SpreadsheetMLPackage.load(inputStream);
    } catch (Docx4JException e) {
     
      throw new RuntimeException("cannot load document", e);
    }
    WorkbookPart workbookPart = spreadSheetPackage.getWorkbookPart();
   
   
    XlsxWorksheetContext worksheetContext = null;
    WorksheetPart worksheetPart;
    try {
      String worksheetName;
      DocPropsExtendedPart docPropsExtendedPart = spreadSheetPackage.getDocPropsExtendedPart();
      if(docPropsExtendedPart!= null && docPropsExtendedPart.getContents().getTitlesOfParts() != null) {
        worksheetName = (String) docPropsExtendedPart.getContents().getTitlesOfParts().getVector().getVariantOrI1OrI2().get(0).getValue();
      } else {
        worksheetName = "default";
      }
      worksheetPart = workbookPart.getWorksheet(0);
      SharedStrings sharedStrings = workbookPart.getSharedStrings();
      worksheetContext = new XlsxWorksheetContext(sharedStrings.getContents(), worksheetPart.getContents(), worksheetName);
    } catch (Exception e) {
      throw new RuntimeException("Could not determine worksheet", e);
    }
    return new XlsxWorksheetConverter(worksheetContext, ioDetectionStrategy).convert();
  }
public dmnmodelinstance convert(inputstream inputstream) { spreadsheetmlpackage spreadsheetpackage = null; try { spreadsheetpackage = spreadsheetmlpackage.load(inputstream); } catch (docx4jexception e) { throw new runtimeexception("cannot load document", e); } workbookpart workbookpart = spreadsheetpackage.getworkbookpart(); xlsxworksheetcontext worksheetcontext = null; worksheetpart worksheetpart; try { string worksheetname; docpropsextendedpart docpropsextendedpart = spreadsheetpackage.getdocpropsextendedpart(); if(docpropsextendedpart!= null && docpropsextendedpart.getcontents().gettitlesofparts() != null) { worksheetname = (string) docpropsextendedpart.getcontents().gettitlesofparts().getvector().getvariantori1ori2().get(0).getvalue(); } else { worksheetname = "default"; } worksheetpart = workbookpart.getworksheet(0); sharedstrings sharedstrings = workbookpart.getsharedstrings(); worksheetcontext = new xlsxworksheetcontext(sharedstrings.getcontents(), worksheetpart.getcontents(), worksheetname); } catch (exception e) { throw new runtimeexception("could not determine worksheet", e); } return new xlsxworksheetconverter(worksheetcontext, iodetectionstrategy).convert(); }