XLSX files to PDF with Peoplecode and Java (XSSFWorkbook)

I'm working on a project to convert Excel .xlsx files pdf files. I did some research and found that maybe using Java in Peoplecode is the best way. Correct me if I'm wrong. I'm still pretty new on this.

I installed these libraries of Java:

  • POI - 3.11.jar
  • Commons-codec - 1.9.jar
  • POI-ooxml - 3.11.jar
  • POI-ooxml-schemas - 3.11.jar
  • XMLBeans - 2.6.0.jar
  • Stax-api - 1.0.1.jar

I am using the reflection technique. I started my code to read a .xlsx file and I'm stuck here:

Local string & file_name = "C:\temp\test1.xlsx";

Type local integer & tempint = 0;

Local JavaObject & input_file = CreateJavaObject ("java.io.File" and file_name);

Local JavaObject & XSSFWorkbook = CreateJavaObject ("org.apache.poi.xssf.usermodel.XSSFWorkbook", & input_file);

Local JavaObject & jClass = GetJavaClass ("java.lang.Class");

Local JavaObject & joint = GetJavaClass ("java.lang.Integer");

Local JavaObject & jIntType = & jInt.TYPE;

Local JavaObject & jIntArgTypes = CreateJavaObject ("java.lang.Class []", & jIntType);

Local JavaObject & jGetSheetAt = & XSSFWorkbook.getClass () .getDeclaredMethod ("getSheetAt", & jIntArgTypes);

Local JavaObject & jSheet1 = & jGetSheetAt.invoke (& XSSFWorkbook, CreateJavaObject ("java.lang.Object []", CreateJavaObject ("java.lang.Integer", "0")));

REM JavaObject Local & jSheet1 = & jGetSheetAt.invoke (& XSSFWorkbook, CreateJavaObject ("java.lang.Object []", 0));

Local JavaObject & jRowIterator = & jSheet1.getClass () .getDeclaredMethod ("iterator", Null);

Local JavaObject & jIterator = & jRowIterator.invoke (& jSheet1, CreateJavaObject ("java.lang.Object []"));

REM JavaObject Local & jRowNext = & jIterator.getClass () .getDeclaredMethod ("next", Null);

REM JavaObject Local & jNextRow = & jRowNext.invoke (& jIterator, CreateJavaObject ("java.lang.Object []"));

REM JavaObject Local & jRowHasNext = & jIterator.getClass () .getDeclaredMethod ("hasNext", Null);

REM JavaObject Local & jHasNext = & jRowHasNext.invoke (& jIterator, CreateJavaObject ("java.lang.Object []"));

The last four commented lines are where I have a lot of trouble with. I understand, finally, I need to put them in a while loop to read each line which contained and that each cell. But I still can't get there. I don't seem to be able to call the next() and hasNext() methods correctly. When I Uncomment the first two lines to call next(), it gives me error "Exception Java: java.lang.InternalError: during the java.lang.reflect.Method.invoke call.» VH_XLTOPDF (2 763). PRINCIPAL. «GBL.default.1900 - 01 - 01.Step07.OnExecute PCPC:1675 statement: 14»

And when I Uncomment the last two lines to call hasNext(), it gives an error "Exception Java: java.lang.NoSuchMethodException: java.util.TreeMap$ ValueIterator.hasNext (): during the java.lang.Class.getDeclaredMethod call.» VH_XLTOPDF (2 763). PRINCIPAL. «GBL.default.1900 - 01 - 01.Step07.OnExecute PCPC:1539 statement: 13»

Any help would be appreciated. Or, if this is the wrong way to get what I'm trying to achieve, please advice. Thank you much in advance.

I hope you're on 8.54? If so, you might be better to use a server side of technical script described by Jim Marion on his blog. Otherwise, you will encounter a lot of problems with the reflection which is a pain to say the least.

Jim's PeopleSoft journal: JavaScript on the application server: Scripting PeopleCode

I tried to play with she me and found it very convenient to overcome the problems of reflection (see step 3 in the link below).

http://pe0ples0ft.blogspot.com/2015/11/implementing-reCAPTCHA-20-in-PeopleSoft.html

In addition, this thread talking about it a bit. Someone has used this technique for POI libraries to create spreadsheets.

The Java Exception: java.lang.reflect.InvocationTargetException: during the java.lang.reflect.Method .invoke call.

Hope that gives you some ideas. Thank you!

Tags: Oracle Applications

Similar Questions

  • Could you please tell me the name of the program that plays the files (mp3) begins with V and resembles a cone orange and white?

    Could you please tell me the name of the program that plays the files (mp3) begins with V and resembles a cone orange & white?

    VLC.

    http://www.videolan.org/VLC/

  • Is there a package from Adobe for a single user who would allow me to merge/combine PDF files, convert PDF to Word and I would use echosign?

    Is there a package from Adobe for a single user who would allow me to merge/combine PDF files, convert PDF to Word and I would use echosign?

    Hi mm12798893,

    For all these features, please see the service pack Adobe PDF or Acrobat DC subscription.

    See these KB doc for more information:

    https://www.Acrobat.com/en_US/landing/EXPORTPDF-pricing-b.html let us know if you need help.

    Kind regards

    Meenakshi

  • Export DataGrid data to the file with JSP and Java

    My user must be able to load the data into a spreadsheet. I would like to stay with Flex and not use air. I used the windows clipboard, but I experience delays of Flash Player for the largest data sets if the closure of the DataGrid rows takes longer than 2 minutes. I would like to do with passing data to a JSP page or use BlazeDS and then download the file. I would just pass the ArrayCollection collection so I don't have to loop through the rows of the DataGrid. I know that I can receive a Java ArrayList using BlazeDS and it gets converted to an ArrayCollection collection. Is it possible to send an ArrayCollection collection to a JSP page or class Java with BlazeDS?

    If you want to use JSP and Java, I presented the following article on the Flex Cookbook site that explains how do.
    Flex generic data exporter to CSV file

  • Can I convert a ppt file to PDF with PDF Pack with two blades to the page?

    I want to convert a ppt file to pdf format with two blades on the page, rather than a slide page. I can do this with a printer. How do I do this with pdf pack?

    Hi sandyd,.

    When you convert PowerPoint to PDF via Adobe PDF Pack, it will convert each slide in the deck to a page in the PDF file. Unfortunately, there is no way to change this.

    Best,

    Sara

  • Why mozzila is read my as .xlsx files "application / vnd.spreadsheet - openxml" and not as "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet?

    IM reading files with PHP .xlsx, until the yestarday it works well, but today I can't read my files because of this; in other browsers it works fine.

    THX

    35 Firefox came out today. You are 6 versions behind now!
    You can use the help > about Firefox to check updates and install the latest version.

    Firefox through the MIME Type that is sent with the file. This change was probably made on the server from these files. If you can provide a URL to the Web page where you can download these files from someone here can look in the source of this problem further.

  • Cannot save files to PDF with CS5

    What should I do to register once more pdf files with off gel HAVE

    happens with all files?

    or a particular file?

    assuming that you have already saved this file as a file .ai - and - you had checked the box (circled in the picture)...

    Just copy the .ai file to another folder and change the .pdf file extension

    However, if the file is to give you problems is very complex and/or large - could be the PDF settings that you use which are?

    and what OS are you running MAC or Win


  • How to create a flexible PDF with hide and show?

    Hello

    It is a flexible PDF document but I don't know how to create with hide & show.

    My form has the following structure:

    Form1

    master pages

    Page1

    ...

    Participants (present the script following due to the 'ZeileHinzufuegen' button

    Weitere

    Subweitere

    TextField

    ...

    Line

    ...

    Button

    ZeileHinzufuegen

    'ZeileHinzufuegen' in 'Participants' script, too:

    Formular1.Page1.Teilnehmer.ZeileHinzufuegen::click - (JavaScript, client)

    oHelper.addInstance (parent.weitere._Subweitere);

    If I click on "ZeileHinzufuegen", another line with textfields... must be included.

    How to do this?

    Thanks in advance for helping me

    Hi Matthias,

    The script seem to be good!

    I know that you have already tried, but because the radio button group and the Hotel subform are in the same container (May) then you could shorten the reference. This isn't the problem, but it will be cleaner.

    If (this.rawValue == 1)

    {

    Hotel.Presence = "visible";

    }

    on the other

    {

    Hotel.Presence = 'hidden ';

    }

    The form should be saved under the dynamics:

    Apart from that I don't know what goes wrong. You can share the form? It would make it easier.

    The second sample is shared on Acrobat.com, you do not have to register to gain access. I suggest you try again and selecting the file to download. I downloaded another service: http://dl.dropbox.com/u/8257540/2010-04-03%20Looping%20through%20repeating%20rows.pdf

    Niall

  • Need help with jsp and java bean

    A Department has built its own site using jsp. I need to get this up and running through cf7.1

    I created a server instance, so it is separated from the rest of the intranet.
    Basically, I think I need to 'install' the javabean. But don't know how.

    Code added to the web.xml file
    < servlet-mapping >
    controller < servlet name > - < / servlet-name >
    *.do < url-pattern > < / url-pattern >
    < / servlet-mapping >

    The login page is called a link
    127.0.0.1/servlet/controller?page=login

    The jsp code is as Attaché (initial login page)

    There is a file 'LoginBean.java '.

    Now for the error

    jrun.jsp.tags.GetProperty$ NoSuchPropertyException: (/ loginPage.jsp:13) the loginBean bean has no property enteredcustomerid
    at jrun.jsp.tags.GetProperty.init(GetProperty.java:78)
    at jrun.jsp.tags.GetProperty.doStartTag(GetProperty.java:39)
    at jrun__loginPage2ejspe._jspService(jrun__loginPage2ejspe.java:75)
    at jrun.jsp.runtime.HttpJSPServlet.service(HttpJSPServlet.java:43)
    at jrun.jsp.JSPServlet.service(JSPServlet.java:119)
    at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
    at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
    at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:257)
    at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:541)
    at jrun.servlet.http.WebService.invokeRunnable(WebService.java:172)
    to jrunx.scheduler.ThreadPool$ ThreadThrottle.invokeRunnable (ThreadPool.java:426)
    at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)

    jrun.jsp.runtime.UncaughtPageException: unmanaged by the exception that is thrown from /loginPage.jsp:13
    at jrun.jsp.runtime.Utils.handleException(Utils.java:57)
    at jrun.jsp.runtime.JRunPageContext.handlePageException(JRunPageContext.java:384)
    at jrun__loginPage2ejspe._jspService(jrun__loginPage2ejspe.java:119)
    at jrun.jsp.runtime.HttpJSPServlet.service(HttpJSPServlet.java:43)
    at jrun.jsp.JSPServlet.service(JSPServlet.java:119)
    at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91)
    at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42)
    at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:257)
    at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:541)
    at jrun.servlet.http.WebService.invokeRunnable(WebService.java:172)
    to jrunx.scheduler.ThreadPool$ ThreadThrottle.invokeRunnable (ThreadPool.java:426)
    at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)


    Any help please...

    Ken

    Tim,

    I want to thank you for your help on this. If I you never have an event, drinks are on me.

    I created a new server through the cf admin instance, this created all required files files.
    Although the jrun - Web.xml wasn't in the web - inf folder. So I copied to this location and inserted your piece of code.
    I then copied the code from the web.xml file and the web_frim_beans.xml that we have with the application and paste it into the Web.XML of the server instance.
    Then I copied all the files of the classes in the application folder in the folder for the server instance class.
    I copied then only the application files in the cfusion.war file that was created.

    Then, I stopped and restarted the server instance, but because of the case in the login page, it did not work.
    So, I then made changes as you suggest to the loginPage.jsp and the LoginBean.java file.

    Then, I stopped and restarted the instance server again.

    Everything worked as it should.

    Again, thank you.

    Ken

  • Can delete you the files that end with .chk and also a file called PP11Thumbs.ptn

    I'm trying to clean up my computer and laptop hard drive.

    I noticed in a folder called my works in the laptop hard drive called PP11Thumbs.ptn - I did a little research - but not too sure if it causes problems with the operation of the system.

    The other problem is the .chk extension - Fragments of recovered files (.) (CHK)

    I saw on google registry cleaners - but I don't do them not trust.

    Thanks to you all.

    Hi Melissa,

    Please contact Microsoft Community Forum. Thanks for giving me the opportunity to help you. I'll guide you to the topic to delete PP11Thumbs.ptn and .chk files.

    . PTN files are used by a program called paper Port. So, if you use paper Port program, then you may need to check with the help of paper Port of the seller about this file matches.

    The. CHK files are safe to remove it from the computer. You can use Disk Cleanup to do.

    Using the windows-related issues feel free to post on the Microsoft Community Forum.

    I wish you happy and prosperous new year.

  • PDF with portrait and Landscape Orientation act differently between pages

    Hello

    I have problem when I try to have an orientation landscape in a PDF document with another page in portrait.

    All I want to do is have a small page that shows the instructions on the form because it is a generator of form, once the form is created by the user, the landscape page becomes hidden.

    My problem here is that when I put a masterpage in landscape mode it makes it different to switch between pages.

    I see more than 1 page at a time, just as it cannot show a landscape and portrait together on the screen.

    I have another form of landscape and portrait together and it works fine, but this form is not normal... There must be something that I am missing...

    It's annoying that I can't have more than one page on the screen, once I hit the bottom or top of the page it will automatically switch to the other page.

    Please help me on this, I'm trying to figure out what is the cause of this bug...

    Hello

    I didn't use the form builder, but you still have a view state, try adding the following line in the form docReady event

    event.target.viewState = {pageViewLayoutMode:2};

    This has the same effect as setting to activate the scrollbars on the view... Menu page display.

    A value of 1 would give you unique page view.

    Concerning

    Bruce

  • best way to download files by 2 with winzip and rar files

    I have winzip pro I'm having problems to download rar and 2 files

    If you are referring to several files of party as download.rar, download.part2.rar, etc., you have to open the first file (download.rar in this example) and check out as usual - WinZip should automatically read the other files.

  • How to resize a page file of pdf with Acrobat Pro?

    Acrobat Pro, how can you resize a page to PDF (21.38 x 26.75 mm ") into a single measure 6" x 9 ", which will be submitted as the trim size? Is there a feature that allows it to be? How does set an all printing options in the print Application dialog box to adjust the size of a page of custom file?

    Pages wide you need to tax a plugin or script in Acrobat.

    Alternatively, you can print them on the Adobe PDF printer using the desired page size, well that which will remove all the file contains metadata (bookmarks, fields, comments, etc.).

  • Excel 2010 does not open .xlsx files by double click in Explorer... photo mgr open

    I am running Windows 7 since 12/2010 and have been using office 2007.  06/05/12, I installed office 2010.  Since that time the new excel will not open .xlsx files in Explorer by double clicking on the file name... Excel 2007 does that very well.  Instead of excel opens, Manager of photo is trying to open up.  I tried to change the default program assignments, but the only options are Office 2010, Microsoft Works Spreadsheet and Microsoft Open XML converter.  No does the job and as I mentoned, if I take of Office 2010, it tries to open Picture Manager who can not read the file.  There is no good Excel option to the association of .xls, it shows Excel as the deafult.

    It was livable, until people began to send me .xlsx files attached to an email and he's trying to open them as pcitures.

    Try to edit the file in this way association

    In Windows 7:
    1 right click on the file,
    2. Select 'Open with' select [Choose default program]
    3. click the Browse button and navigate to Excel [example: C:\Program Files (x 86) \Microsoft Office\Office14\excel.exe]
    4. check always use this program.
  • Convert block of text to PDF with Acrobat

    Hello. When to convert a text file to PDF with Acrobat X Pro the spacing of the characters in the resulting file is incorrect.  The columns of figures that line up correctly in the text file, do not properly align in the PDF file.  I adjust the conversion settings in the CREATE PDF FROM WEB PAGE THE box and I chose a fixed-width font.   If I use Adobe PDF Converter (printer driver), the result is perfect.  If I open the text file with Microsoft Word and then convert it to PDF with PDFMaker, it is also perfect. I want to use Acrobat so that I can bulk convert my files 300 text in PDF format.   Can you please help as I have tried everything?  Thank you.  Paul Pontikis (Deakin University)

    How are the files PDF, text is a set of text-as-graphics. Individual graphs can be lines, words or even simple letters. So there aren't really spaces at all in many files, just the text is a little further away.

    Clearly Acrobat calculates wrong - I think as I said, this looks like a rounding error.

    There nothing like what you are looking for - once the PDF file is made, the locations are fixed.

Maybe you are looking for

  • new helmet SE

    The EarPods of my new IPHONE OS [BOUGHT YESTERDAY JUNE 10] does not work.  How Apple replaced for new ones?

  • Satellite P850 - where to get the Toshiba Blu - ray player?

    Hello Recently, I reformatted my p850/049 for windows 7. I tried to install the drive Blu - Ray Toshiba V1.0.3.196A, the file did not work at all and when I tried to install it manually "can't find drive in your system. Installation interrupted. On t

  • G7-2341dx

    the g7-2341dx come with bluetooth capability? If a train stops at a train station which then becomes a workstation work?

  • 8.1 Windows backup and restore of factory installed windows 8 PC

    Hey there, IAM using HP Pavilion N007ax laptop... when buying my laptop, I have cams with pre - installed Windows 8 Operating Sytem with a factory image... in the case of problem backup system I can easily back this OS and back to normal... Finally,

  • Microsoft Windows Remover malware tool to get rid of Rootkits?

    Specifically the hidden Rootikits. (I have 288} :()  And if he dosent at - it does anyone know a good free stripper hidden Rootkit or manual mode? I found them using Comodo Antivirus, but it cannot remove it :( Please help me! -Patrick Mizerski EDIT: