We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am trying to set the keyword property in the excel file as 'Confidential' by using the below method
workbook = FastExcel.open('./dummy.xlsx') workbook.set_properties({ keywords: 'Confidential' })
It gives me error that "Argument is not a valid pointer"
After Going through the gem it looks like that it expects a DocProperties Object
d = Libxlsxwriter::DocProperties.new
d[:keywords] = 'Confidential'
workbook.set_properties(d)
When i try to assign d[:keywords] = 'Confidential' then it gives me error that "Cannot set string field"
Could you please let me know how to assign properties
The text was updated successfully, but these errors were encountered:
I think this is related ffi/ffi#10 Need to make some setter methods... will try to make it easier and documented later.
For now I was able to make it works like this:
require_relative 'fast_excel' class Libxlsxwriter::DocProperties < FFI::Struct def keywords=(val) pos = offset_of(:keywords) if val.is_a?(String) val = FFI::MemoryPointer.from_string(val) end if val.nil? self.pointer.put_pointer(pos, FFI::MemoryPointer::NULL) elsif val.is_a?(FFI::MemoryPointer) self.pointer.put_pointer(pos, val) else fail("keywords= requires an FFI::MemoryPointer or nil") end val end end workbook = FastExcel.open("example_workbook_properties.xlsx", constant_memory: true) props = Libxlsxwriter::DocProperties.new props.keywords = 'Confidential' workbook.set_properties(props) # print properties FastExcel.print_ffi_obj(workbook[:properties]) workbook.close
Sorry, something went wrong.
@Paxa Is there any way how to make this more simple using hashes?
@Laykou Not yet, PRs are welcome :)
Yeah, this is a bit low-level to me with the C-like programming, pointers and FFI :P
Paxa
No branches or pull requests
I am trying to set the keyword property in the excel file as 'Confidential' by using the below method
workbook = FastExcel.open('./dummy.xlsx')
workbook.set_properties({ keywords: 'Confidential' })
It gives me error that "Argument is not a valid pointer"
After Going through the gem it looks like that it expects a DocProperties Object
d = Libxlsxwriter::DocProperties.new
d[:keywords] = 'Confidential'
workbook.set_properties(d)
When i try to assign d[:keywords] = 'Confidential' then it gives me error that "Cannot set string field"
Could you please let me know how to assign properties
The text was updated successfully, but these errors were encountered: