Reading Signature lines using OpenXMlSDK - ms-office

I just started office development and have been trying to read a word 2013 document that holds signature fields in it using open xml sdk
can some one help me how to do that.
using (var document = WordprocessingDocument.Open(#"D:\Temp_Folder\tempfile.docx", false))
{
var docPart = document.MainDocumentPart;
}
I have tried reading word file using ELdos (SBOffice) I can get signature lines but not able to get full details related to Signature Lines like Suggested Signer and Suggested Signer email.
Can some one suggest me which I have to prefer OpenXMLSDK or Eldos(SBOffice) bcz i need to find signature fields and then sign them by custom certificate using Third party Signing Service.

The best way would be to use the OpenXMLSDKTool to open the document and it will show you the code necessary to replicate it. I believe it would be within a shape something like
using (var document = WordprocessingDocument.Open("YourDoc.docx", false)
{
var signature = document.MainDocumentPart.Document.Descendant<DocumentFormat.OpenXML.VML.Office.SignatureLine>().FirstOrDefault();
var suggestedSigner = signature.SuggestedSigner;
var suggestedSignerTitle = signature.SuggestedSigner2;
var suggestedSignerEmail = signature.SuggestedSIgnerEmail;
}
You could get the actual signature image in this same area.

Related

How does one access an Extension to a table in Acumatica Business Logic

Apologies if this question has been answered elsewhere, I have had trouble finding any resources on this.
The scenario is this. I have created a custom field in the Tax Preferences screen called Usrapikey.
This value holds an api key for a call that gets done in some custom business logic.
The custom business logic however occurs on the Taxes screen.
So within the event handler I need to access that API key value from the other screen. I have tried instantiating graphs and using linq and bql but to no avail.
below is what I have currently and my error is: No overload for method 'GetExtension' takes 1 arguments
If I am going about this the wrong way please let me know if there is a more civilized way to do this
protected virtual void _(Events.FieldUpdated<TaxRev, TaxRev.startDate> e)
{
var setup = PXGraph.CreateInstance<TXSetupMaint>();
var TXSetupEX = setup.GetExtension<PX.Objects.TX.TXSetupExt>(setup);
var rateObj = GetValues(e.Row.TaxID, TXSetupEX.Usrapikey);
decimal rate;
var tryRate = (Decimal.TryParse(rateObj.rate.combined_rate, out rate));
row.TaxRate = (decimal)rate * (decimal)100;
row.TaxBucketID = 1;
}
Many Thanks!
Well, acumatica support got back. It seems if you want to access the base page use:
TXSetup txsetup = PXSetup<TXSetup>.Select(Base);
To get the extension use:
TXSetupExt rowExt = PXCache<TXSetup>.GetExtension<TXSetupExt>(txsetup);
Then you can access the extension fields like so:
var foo = rowExt.Usrfield;

SOAP + Zeep + XSD extension

Am interacting with a SOAP service through Zeep and so far it's been going fine, except I hit a snag with regards to dealing with passing values in anything related to an XSD extension.
I've tried multiple ways and am at my wits end.
campaignClient = Client("https://platform.mediamind.com/Eyeblaster.MediaMind.API/V2/CampaignService.svc?wsdl")
listPaging = {"PageIndex":0,"PageSize":5}
fact=campaignClient.type_factory("ns1")
parentType = fact.CampaignIDFilter
subtype=dict(parentType.elements)["CampaignID"] = (123456,)
combined= parentType(CampaignID=subtype)
rawData = campaignClient.service.GetCampaigns(Paging=listPaging,CampaignsFilter=combined, ShowCampaignExtendedInfo=False,_soapheaders=token)
print(rawData)
The context is the following :
this service is to get a list of items and it's possible to apply a filter to it, which is a generic type. You can then implement any type of filter matching that type, here a CampaignIDFilter.
My other attempts failed and the service used to pinpoint incorrect type or such but this way - which I think is on paper sound, gets me a 'something went wrong'.
I'm literraly implementing the solution found here : Creating XML sequences with zeep / python
Here's the service Doc http://platform.mediamind.com/Eyeblaster.MediaMind.API.Doc/?v=3
Cheers
Turns out the right way to get there was to hack around a bit to get the right structure and use of types. The code itself :
objectType = campaignClient.get_type('ns1:CampaignIDFilter')
objectWrap = xsd.Element('CampaignServiceFilter',objectType)
objectValue = objectWrap(CampaignID=123456)
wrapperT = campaignClient.get_type('ns1:ArrayOfCampaignServiceFilter')
wrapper = xsd.Element("CampaignsFilter",wrapperT)
outercontent = wrapper(objectValue)
This ends up generating the following XML :
<soap-env:Body>
<ns0:GetCampaignsRequest xmlns:ns0="http://api.eyeblaster.com/message">
<ns0:CampaignsFilter>
<ns1:CampaignServiceFilter xmlns:ns1="http://api.eyeblaster.com/V1/DataContracts" xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance" xsi:type="ns1:CampaignIDFilter">
<ns1:CampaignID>123456</ns1:CampaignID>
</ns1:CampaignServiceFilter>
</ns0:CampaignsFilter>
<ns0:Paging>
<ns0:PageIndex>0</ns0:PageIndex>
<ns0:PageSize>5</ns0:PageSize>
</ns0:Paging>
<ns0:ShowCampaignExtendedInfo>false</ns0:ShowCampaignExtendedInfo>
</ns0:GetCampaignsRequest>
</soap-env:Body>
Much credit to the user here which gave me the boiler plate needed to get this lovecraftian horror to work how to specify xsi:type zeep python

NotesException: Unknown or unsupported object type in Vector

I'm trying to add new names to the address book programmatically but I'm getting the following error:
[TypeError] Exception occurred calling method NotesDocument.replaceItemValue(string, Array)
Unknown or unsupported object type in Vector
Code snippet below:
var addressBook = session.getDatabase("","names.nsf");
var gView:NotesView = addressBook.getView("($VIMGroups)");
var gDoc:NotesDocument = gView.getDocumentByKey("groupName", true);
var newg:java.util.Vector = [];
var mems:java.util.Vector = new Array(gDoc.getItemValue('Members'));
newg.push(mems);
var newNames:java.util.Vector = new Array(getComponent("NewMems").getValue());
newg.push(newNames);
gDoc.replaceItemValue("Members", newg);
gDoc.save();
Adding a single user works fine, but then it does not save users in the required canonical format below:
CN=John Doe/O=Org
Instead it is saved in the original format below:
John Doe/Org
I look forward to your suggestions. Thanks.
You can't store an Array in a field. Make newg a java.util.Vector instead and integrate with that.
For OpenNTF Domino API the team wrote a lot of code to auto-convert to Vectors, which may cover Arrays.
Don't use an Array (which is a JS thing). Initialize it as a Vector.
var newg:java.util.Vector = new java.util.Vectory();
Then look up the Vector methods to see how to add to that vector. Not sure if you will have to convert the names using the Name method but I would store them as "CN=Joe Smith/O=Test Org" to be sure you got the right format.
I was able to solve the issue using a forloop to loop through the list and push it into a newly created array. Using the forloop seems to make the difference.
var newg = [];
var group = new Array(getComponent("NewMems").getValue()), lenGA = group.length;
for(i = 0; i < lenGA; i++){
newg.push(group[i]);
}
gDoc.replaceItemValue("Members", newg);
gDoc.save();
An explanation about this behaviour will be appreciated.

How to extract lists from Sharepoint which includes the attacthments

Any idea's on how to extract a list (not Library's) from Sharepoint that includes the attachments.
When i extract to excel the attachments column just says YES or NO but no actual copy or link to the attachment.
Any help would be greatly appreciated.
The property you need to use is SPListItem.Attachments (documentation)
Since you haven't provided any code to work from I've had to make a simple example. I would suggest posting the code you're working on in future, you will receive much better replies.
using (var objSite = new SPSite("http://sharepointsite"))
{
using (var web = objSite.OpenWeb())
{
var objlist = web.Lists["Testing List"];
var objItem = objlist.GetItemById(1);
var attachments = objItem.Attachments;
}
}

Is there a way to get all embedded objects in .xlsx file using xssf event mdel api

Is there a way to get all embedded objects in .xlsx file using xssf event model api?
Usermodel has the method workbook.getallembedds...similarly is there anything in eventmodel?
This is an example in usermodel.I want to implement the same functionality using eventusermodel.Kindly help.
for (PackagePart pPart : workbook.getAllEmbedds()) {
String contentType = pPart.getContentType();
if (contentType.equals(------)
Instead of xssfworkbook(in usermodel), in the eventmodel code i have a containerObject of type OPCPackage.
#Gagravarr : Thanks for your reply. I tried using the method suggested by you...but im unable to get the contents of the embedded excel.Could you please help me find out where I am going wrong.Here is a part of the code:
ReadOnlySharedStringsTable strings = new ReadOnlySharedStringsTable(container);
XSSFReader xssfReader = new XSSFReader(container);
XSSFReader.SheetIterator iter = (XSSFReader.SheetIterator)xssfReader.getSheetsData();
for(PackageRelationship rel : iter.getSheetPart().getRelationshipsByType(XSSFRelation.OLEEMBEDDINGS.getRelation()))
embedds.add(getTargetPart(rel));
for (PackagePart pPart :getAllEmbedds()) {
String contentType = pPart.getContentType();
// Excel Workbook - OpenXML file format
if (contentType.equals("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml")) {
OPCPackage excelObject = OPCPackage.open(pPart.getInputStream());
`
Your best bet is probably just to enumerate all the package parts, and find the ones that interest you from that
Alternately, the logic to identify embedded parts attached to a given sheet is pretty simple:
List<PackagePart> embedds = new LinkedList<PackagePart>();
// Get the embeddings for the workbook
for(PackageRelationship rel : sheet.getSheetPart().getRelationshipsByType(XSSFRelation.OLEEMBEDDINGS.getRelation()))
embedds.add(getTargetPart(rel));
for(PackageRelationship rel : sheet.getSheetPart().getRelationshipsByType(XSSFRelation.PACKEMBEDDINGS.getRelation()))
embedds.add(getTargetPart(rel));
return embedds;
Finally all I used was this!
ArrayList<PackagePart> parts = container.getParts();
for (PackagePart pPart :parts) {
String contentType = pPart.getContentType();
if (contentType.equals("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")) {

Resources