Re: Usage about pyuno
Hey regina, Thanks very very much that you did help me. :-) And sorry for the delay of response. I forget that I have not send you a thanks letter. Have a good day! :-) 2015-05-08 17:52 GMT+08:00 Regina Henschel rb.hensc...@t-online.de: Hi, He Sun schrieb: 2015-05-08 15:34 GMT+08:00 Marcus marcus.m...@wtnet.de: Am 05/08/2015 04:14 AM, schrieb He Sun: [..] Thanks very very much for your kindly reply, it does help me some way. :-) The factor the option and so on if I find the API to deal with it. you can start on https://wiki.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Overall_Document_Features section Page Styles. Kind regards Regina - To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org For additional commands, e-mail: dev-h...@openoffice.apache.org - To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org For additional commands, e-mail: dev-h...@openoffice.apache.org
Re: Usage about pyuno
2015-05-08 15:34 GMT+08:00 Marcus marcus.m...@wtnet.de: Am 05/08/2015 04:14 AM, schrieb He Sun: I need your *HELP* The problem is, using xsl2pdf.py to convert tmp.xls to tmp.pdf, but the tmp.pdf has page info '1' on the head and tmp.xls on the foot, and the excel didnot fill the full pdf page. I want: 1. remove '1' from the head. 2. remove 'tmp.xls' from the foot. 3. extends the excel to fill the full pdf page. How can I achieve these goals by using OpenOffice? I don't know if you want or have to solve the problems via API programming. Then I cannot help you. Indeed, I have to use API programming because the project need to generate PDF from excel. -_-|| Otherwise here are some comments: - Please check the output via File - Page preview. Here you can already see the header/footer data and the size of the print out. - The XLS file includes an enabled header and footer. Therefore you see the file name and page number there. Go to Format - Page and uncheck the option on the header/footer tab page (Header on and Footer on). - When you want to see the complete sheet in the PDF then you have to scale the page. Go to Format - Page - Sheet - Scaling factor. I've seen good results until 180%. More will breakup into more pages. However, I've checed the display only with page format A4. With other page formats the results are likely different and a higher scaling factor could be possible. Thanks very very much for your kindly reply, it does help me some way. :-) The factor the option and so on if I find the API to deal with it. I hope this helps. Marcus - To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org For additional commands, e-mail: dev-h...@openoffice.apache.org Thanks a lot. :-) Have a good day. - To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org For additional commands, e-mail: dev-h...@openoffice.apache.org
Usage about pyuno
Hi all, I need your *HELP* The problem is, using xsl2pdf.py to convert tmp.xls to tmp.pdf, but the tmp.pdf has page info '1' on the head and tmp.xls on the foot, and the excel didnot fill the full pdf page. I want: 1. remove '1' from the head. 2. remove 'tmp.xls' from the foot. 3. extends the excel to fill the full pdf page. How can I achieve these goals by using OpenOffice? Thank you all very much in advance! Wish you all a good day/night. :-) tmp.xls Description: MS-Excel spreadsheet #!/usr/bin/env python # encoding: utf-8 import uno from os.path import abspath from com.sun.star.beans import PropertyValue from com.sun.star.connection import NoConnectException DEFAULT_OPENOFFICE_PORT = 8100 class ConvertException(Exception): def __init__(self, message): self.message = message def __str__(self): return self.message class Excel2PdfConverter(): def __init__(self, port=DEFAULT_OPENOFFICE_PORT): localContext = uno.getComponentContext() resolver = localContext.ServiceManager.createInstanceWithContext(com.sun.star.bridge.UnoUrlResolver, localContext) try: context = resolver.resolve(uno:socket,host=localhost,port=%s;urp;StarOffice.ComponentContext % port) except NoConnectException: raise ConvertException, failed to connect to OpenOffice.org on port %s % port self.desktop = context.ServiceManager.createInstanceWithContext(com.sun.star.frame.Desktop, context) def convert(self, inputFile, outputFile, properties={}): inputUrl = uno.systemPathToFileUrl(abspath(inputFile)) outputUrl = uno.systemPathToFileUrl(abspath(outputFile)) document = self.desktop.loadComponentFromURL(inputUrl, _blank, 0, self._toProperties({Hidden:True})) try: document.refresh() except AttributeError: pass args = self._toProperties({ FilterName: writer_pdf_Export, }) try: #document.storeToURL(outputUrl, self._toProperties(storeProperties)) document.storeToURL(outputUrl, tuple(args)) finally: document.close(True) def _toProperties(self, dict): props = [] for key in dict: prop = PropertyValue() prop.Name = key prop.Value = dict[key] props.append(prop) return tuple(props) converter = Excel2PdfConverter() converter.convert(tmp.xls, tmp.pdf) - To unsubscribe, e-mail: dev-unsubscr...@openoffice.apache.org For additional commands, e-mail: dev-h...@openoffice.apache.org