converter

Docx to Pdf Converter in java

梦想的初衷 提交于 2019-11-28 13:06:33
The below code is not working with Apache poi 3.16. Can someone provide with the correct solution, in my project there are some dependency for using only public void ConvertToPDF(String docPath, String pdfPath) { try { InputStream doc = new FileInputStream(new File(docPath)); XWPFDocument document = new XWPFDocument(doc); PdfOptions options = PdfOptions.create(); OutputStream out = new FileOutputStream(new File(pdfPath)); PdfConverter.getInstance().convert(document, out, options); System.out.println("Done"); } catch (FileNotFoundException ex) { System.out.println(ex.getMessage()); } catch

Converter class getAsObject pass parameter to Service class which accepts object

我的梦境 提交于 2019-11-28 12:58:08
问题 I have question regarding Converter class getAsObject method I have a service called EmployeeService employeeService public List<Employees> getEmployees(Employees employees); If I want to call the above method from getAsObject of Converter class which as arguments public Object getAsObject(FacesContext facesContext, UIComponent component, String value) employeeService.getEmployees(<?>) How do I pass employees object to getEmployees method from getAsObject ? Any help is highly appreciated.

How can I check if a string has a numeric value in it in Python? [duplicate]

牧云@^-^@ 提交于 2019-11-28 11:52:23
Possible Duplicate: How do I check if a string is a number in Python? Python - Parse String to Float or Int For example, I want to check a string and if it is not convertible to integer(with int() ), how can I detect that? Use the .isdigit() method : >>> '123'.isdigit() True >>> '1a23'.isdigit() False Quoting the documentation: Return true if all characters in the string are digits and there is at least one character, false otherwise. For unicode strings or Python 3 strings, you'll need to use a more precise definition and use the unicode.isdecimal() / str.isdecimal() instead; not all Unicode

Convert XML latin1 to UTF-8 and other way around

倖福魔咒の 提交于 2019-11-28 11:50:41
问题 I am trying to convert an XML file from Latin1 to UTF-8 and the other way around. I have been doing some tests, but I fail to succeed this. I'm using Get-Content C:\inputfile.xml | Set-Content -Encoding utf8 C:\outputfile.xml But this is not converting anything. So I tried to give the encoding in the Get-Content , but Latin1 is not recognized in PowerShell (or that's what the error message is telling me). What's the best way to get this? 回答1: The fastest method, especially with large XML

Silverlight 4 Binding to ConverterParameter

拈花ヽ惹草 提交于 2019-11-28 11:15:46
问题 I have a ValueConverter which needs to be called with a dynamic parameter, depending on a property. I can't see a way to do this ... Width="{Binding ActualWidthValue, Source={StaticResource VisibleSize}, Converter={StaticResource Fraction}}" The "Fraction" converter get's (or should get) a parameter of type System.Size, which contains a numerator and denumerator. This value (should) depend on a ItemCollection.Count. Resetting the ItemCollection should reinvoke the Converter with the new

Dynamic TryParse for all data types

吃可爱长大的小学妹 提交于 2019-11-28 11:11:08
问题 I have the need to examine to see if an object can be converted to a specific DataType or not, and came up with this : public static bool TryParseAll(System.Type typeToConvert, object valueToConvert) { bool succeed = false; switch (typeToConvert.Name.ToUpper()) { case "DOUBLE": double d; succeed = double.TryParse(valueToConvert.ToString(), out d); break; case "DATETIME": DateTime dt; succeed = DateTime.TryParse(valueToConvert.ToString(), out dt); break; case "INT16": Int16 i16; succeed =

Free (preferably) PHP RTF to HTML converter? [closed]

跟風遠走 提交于 2019-11-28 10:34:32
I am writing a converter for an old db app which contains a large amount of user entered RTF text. Ideally, the RAW RTF should be converted to HTML for display in a browser. I have tried rtfparseclass from PHP Classes , which works ok, but seems to be thrown off but some of the embedded font definitions. For example, raw RTF like {\f1\fnil Tahoma;} always truncates the output produced by the parser, causing detail to be lost. I don't know RTF well enough to know if that should be valid or not. The class was last updated in 2004 so I'm guessing that it may just be out of date. Other than

How to boolean && two visibility converters

孤街醉人 提交于 2019-11-28 09:36:38
I have two separate converters for visibility, one based on whether a field has been updated and one based on whether a field is allowed to be seen. I use the updatedField one for each text item on my page so that a star shows up next to an updated field. But some text items only are visible to some users based on permission levels. For example: <Image Visibility="{Binding ElementName=MyObject, Path=UpdatedFields, Mode=OneWay, Converter={StaticResource updatedFieldConverter}, ConverterParameter=FieldToTest}" Source="Properties:Resources.star_yellow" /> and <TextBlock FontSize="21" Foreground="

Register converters and converterFactories with annotations in Spring 3

非 Y 不嫁゛ 提交于 2019-11-28 09:21:37
First of all ... Im relatively new in Spring, I use spring 3.x and I DONT LIKE SPRING'S XML CONFIGURATION FILES ... I dont want for every refactoring I do, to run into XML file for updates ... I'm trying to configure spring in a way that for any request, if I have some @RequestParam/@RequestBody/@PathVariable etc with type other than String in my hadlers, spring will convert values to that type correctly or put null to handler's args (I never use primitive types in handler arguments). So far so good ... Until now I've registered all converter/converterFactory classes like this: <bean id=

use of boolean to color converter in XAML

南楼画角 提交于 2019-11-28 08:57:26
I am working on WPF application.I have bound my textblock to my button. I want to set foreground of my textblock to black color when its associated button's isEnabled is true. I want to do this using converter. But its not working . also not giving any error. I have declared following class in my "Models" folder. public class BrushColorConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if ((bool)value) { { return System.Windows.Media.Colors.Black; } } return System.Windows.Media.Colors.LightGreen; } public object