Words license

Hi,
My client has just purchased the Words,Slides and PDF licenses.When I try to include it in ‘Global.asax’ this is the message I receive.The old license(‘Custom.lic’) doesn’t produce this error.

<span style=“font-size:18.0pt;font-family:“Verdana”,“sans-serif”;color:red” lang=“FR-CH”>Erreur du serveur dans l’application ‘/translation’.

<span style=“font-size:18.0pt;font-family:“Verdana”,“sans-serif”;color:red”>

<span style=“font-size:14.0pt;font-family:“Verdana”,“sans-serif”;color:maroon”>The license is not valid for this product.<span style=“font-size:14.0pt;font-family:“Verdana”,“sans-serif”;color:maroon”>

<span style=“font-size:8.5pt;font-family:“Verdana”,“sans-serif”;color:black” lang=“FR-CH”>Description : <span style=“font-size:8.5pt;font-family:“Arial”,“sans-serif”;color:black” lang=“FR-CH”>Une
exception non gérée s’est produite au moment de l’exécution de la
demande Web actuelle. Contrôlez la trace de la pile pour plus
d’informations sur l’erreur et son origine dans le code.

<span style=“font-size:8.5pt;font-family:“Verdana”,“sans-serif”;color:black”>Détails de l’exception: <span style=“font-size:8.5pt;font-family:“Arial”,“sans-serif”;color:black”>System.InvalidOperationException: The license is not valid for this product.

<span style=“font-size:8.5pt;font-family:“Verdana”,“sans-serif”;color:black”>Erreur source:<span style=“font-size:8.5pt;font-family:“Arial”,“sans-serif”;color:black”>

<span style=“font-size:9.0pt;font-family:“Lucida Console”;color:black”>

<span style=“font-size:9.0pt;font-family:“Lucida Console”;color:black”>Ligne 20 : ’ Code that runs when a new session is started

<span style=“font-size:9.0pt;font-family:“Lucida Console”;color:black”>Ligne 21 : Dim lic As Aspose.Words.License = New Aspose.Words.License

<span style=“font-size:9.0pt;font-family:“Lucida Console”;color:red”>Ligne 22 : lic.SetLicense(HttpContext.Current.Server.MapPath(“bin”).ToString + “\” + “Aspose.Words.lic”)

<span style=“font-size:9.0pt;font-family:“Lucida Console”;color:black”>Ligne 23 :

<span style=“font-size:9.0pt;font-family:“Lucida Console”;color:black”>Ligne 24 : End Sub

<span style=“font-size:8.5pt;font-family:“Arial”,“sans-serif”;color:black” lang=“FR-CH”>
<span style=“font-size:8.5pt;font-family:“Verdana”,“sans-serif”;color:black” lang=“FR-CH”>Fichier source : <span style=“font-size:8.5pt;font-family:“Arial”,“sans-serif”;color:black” lang=“FR-CH”>D:\inetpub\vhosts\001translations.com\httpdocs\translation\global.asax<span style=“font-size:8.5pt;font-family:“Verdana”,“sans-serif”;color:black” lang=“FR-CH”> Ligne : <span style=“font-size:8.5pt;font-family:“Arial”,“sans-serif”;color:black” lang=“FR-CH”>22

<span style=“font-size:8.5pt;font-family:“Verdana”,“sans-serif”;color:black” lang=“FR-CH”>Trace de la pile:<span style=“font-size:8.5pt;font-family:“Arial”,“sans-serif”;color:black” lang=“FR-CH”>

<span style=“font-size:9.0pt;font-family:“Lucida Console”;color:black” lang=“FR-CH”>

<span style=“font-size:9.0pt;font-family:“Lucida Console”;color:black”>[InvalidOperationException: The license is not valid for this product.]

<span style=“font-size:9.0pt;font-family:“Lucida Console”;color:black”> x28925c9b27b37a46.x220f433da4115056.x7d0214bf69711dd9(Stream xcf18e5243f8d5fd3) +761

<span style=“font-size:9.0pt;font-family:“Lucida Console”;color:black”> x28925c9b27b37a46.x220f433da4115056.x7d0214bf69711dd9(String x1c1fc72fe1a3b4ea, Assembly x5807f920b6fc67c4) +101

<span style=“font-size:9.0pt;font-family:“Lucida Console”;color:black”> Aspose.Words.License.SetLicense(String licenseName) +41

<span style=“font-size:9.0pt;font-family:“Lucida Console”;color:black”>
ASP.global_asax.Session_Start(Object sender, EventArgs e) in
D:\inetpub\vhosts\001translations.com\httpdocs\translation\global.asax:22

<span style=“font-size:9.0pt;font-family:“Lucida Console”;color:black”> System.Web.SessionState.SessionStateModule.RaiseOnStart(EventArgs e) +8795092

<span style=“font-size:9.0pt;font-family:“Lucida Console”;color:black”> System.Web.SessionState.SessionStateModule.CompleteAcquireState() +237

<span style=“font-size:9.0pt;font-family:“Lucida Console”;color:black”>
System.Web.SessionState.SessionStateModule.BeginAcquireState(Object
source, EventArgs e, AsyncCallback cb, Object extraData) +504

<span style=“font-size:9.0pt;font-family:“Lucida Console”;color:black”> System.Web.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +66

<span style=“font-size:9.0pt;font-family:“Lucida Console”;color:black”> System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +155

Thanks


Hi,


Thanks for your inquiry.

It may be that the exception occurs because you’re applying license of some other product to Aspose.Words component. Please check the products listed in the license by opening the license file in notepad. There, you will see the following tags:

Aspose.Total Product Family

It means that your license is valid for Aspose.Total (all Aspose products).

If we can help you with anything else, please feel free to ask.

Best Regards,

Hi Luc,


Thank you for using Aspose product but I have removed your post containing license contents because it is not allowed to post in the forums for security reasons. For more info please check http://www.aspose.com/corporate/purchase/faqs/send-license-to-aspose-staff.aspx.

Best Regards,

Hi
Luc,


Thanks for sharing your license file via email. I tested your license with Aspose.Words for .Net v11.1.0 and was unable to reproduce this exception on my side. I would suggest you please upgrade to the latest version of Aspose.Words i.e. v11.1.0 and let us know how it goes on your side.

I hope, this will help.

Best Regards,

Thanks,Awais
Which .DLL should I use- 2.0,3.5 etc.? The site was built in 2007.

Thanks again,
Luc

Hi Luc,


Thanks for your inquiry.

If you need to use Aspose.Words in ASP.Net application, I would recommend you use the DLL that resides in Net2.0 folder.

Best Regards,

Hi Awais,

When I replace the old .DLL with the new one there is an error that starts as follows:

Erreur du serveur dans l'application '/translation'.

Erreur de compilation

Description : Une erreur s'est produite lors de la compilation d'une ressource requise pour répondre à cette demande. Veuillez consulter ci-dessous les détails relatifs à l'erreur en question, puis modifier votre code source de manière appropriée.

Message d'erreur du compilateur: BC30456: 'Round' n'est pas un membre de 'Math'.

Erreur source:

" Ligne 244 : Dim TotalPrice As Double = Double.Parse(objBid.Price.ToString) * Double.Parse(objRequirement.NoOfWords.ToString) Ligne 245 : strContent += "" Ligne 246 : objcountry.CountryID = New SqlDecimal(Double.Parse(objBid.Currency_ID.ToString)) Ligne 247 : objcountry.SelectOne()
Ligne 243 :        strContent += "
" + objRequirement.NoOfWords.ToString + "" + Math.Round(TotalPrice, 2).ToString + "


Fichier source: D:\inetpub\vhosts\001translations.com\httpdocs\translation\App_Code\Admin\FL_ADM_Bid.vb Ligne: 245

The error is very long-I'll try to send it you by email.

Thanks again,

Luc

Hi

Thanks for your request. Most likely this occurs because there is Aspose.Words.Math namespace in the new version of Aspose.Words. So to resolve the problem you can use System.Math.Round instead of Math.Round.

Best regards,

Hi Alexey,

Thanks a lot for your reply.

The Math namespace problem is solved.There is additional error related to the number of arguments:

Message d'erreur du compilateur: BC30516: La résolution de surcharge a échoué, car aucun 'New' accessible n'accepte ce nombre d'arguments

(Overload resolution failed because no 'New' accepts this number of available argumentsOverload resolution failed because no 'New' accepts this number of available arguments)

Erreur source:

Ligne 517 :                    Dim lic As Aspose.Words.License = New Aspose.Words.License
Ligne 518 :                    lic.SetLicense(HttpContext.Current.Server.MapPath("bin").ToString + "\\" + "Aspose.Custom.lic")
Ligne 519 :                    Dim srHtml As New Aspose.Words.Document(file, LoadFormat.Html, "")
Ligne 520 :                    srHtml.UpdateWordCount()
Ligne 521 :                    'Dim str As String = srHtml.GetText


Fichier source: D:\inetpub\vhosts\001translations.com\httpdocs\translation\App_Code\Quotation\quotationForm.vb Ligne: 519
Message d'erreur du compilateur: BC30516: La résolution de surcharge a échoué, car aucun 'New' accessible n'accepte ce nombre d'arguments.

Erreur source:

Ligne 517 :                    Dim lic As Aspose.Words.License = New Aspose.Words.License
Ligne 518 :                    lic.SetLicense(HttpContext.Current.Server.MapPath("bin").ToString + "\\" + "Aspose.Custom.lic")
Ligne 519 :                    Dim srHtml As New Aspose.Words.Document(file, LoadFormat.Html, "")
Ligne 520 :                    srHtml.UpdateWordCount()
Ligne 521 :                    'Dim str As String = srHtml.GetText


Fichier source: D:\inetpub\vhosts\001translations.com\httpdocs\translation\App_Code\Quotation\quotationForm.vb Ligne: 519

Thanks again,

Luc

Hi Luc,


Thanks for your inquiry. The problem occurs because there is no such Document Constructor available in the new version of Aspose.Words. Instead, please try using one from the following list of constructor overloads:

Overloads Public Sub New()

Overloads Public Sub New( _
ByVal fileName As String _
)

Overloads Public Sub New( _
ByVal fileName As String, _
ByVal loadOptions As LoadOptions _
)

Overloads Public Sub New( _
ByVal stream As Stream _
)

Overloads Public Sub New( _
ByVal stream As Stream, _
ByVal loadOptions As LoadOptions _
)

Moreover, I would suggest you read the following article on Migrating from Earlier Versions of Aspose.Words:
http://docs.aspose.com/display/wordsnet/Migrating+from+Earlier+Versions+of+Aspose.Words

I hope, this will help.

Best Regards,

Hi Awais,
Thanks a lot for your response.
So instead of Dim doc As New Aspose.Words.Document(filename, LoadFormat.Html, “”)
it should be Dim doc As New Aspose.Words.Document(file, Html)?

The same with Rtf?

Many thanks in advance,

Luc


Hi Luc,


Thanks for your inquiry. Please read the Opening from a File section from the following link:
http://docs.aspose.com/display/wordsnet/Load+or+Create+a+Document

I hope, this will help.

Best Regards,

Hi Awais,
Thanks a lot for your response.Perhaps a concrete example would be very helpful to me, given the changes and the level of my experience with vb.net.In the following case :

Dim doc As New Aspose.Words.Document(file, LoadFormat.Html, “”)
doc.UpdateWordCount()
Return (doc.BuiltInDocumentProperties.Words)


the file probably should be opened from the stream.



is this the correct way?:


Dim stream As Stream = File.OpenRead(file)

Dim doc As New Aspose.Words.Document(stream)

stream.Close()

doc.UpdateWordCount()

Return (doc.BuiltInDocumentProperties.Words)




Can the “UpdateWordCount” and “BuiltInDocumentProperties.Words” still be used?

Many thanks in advance,

Luc

Hi Luc,


Thanks for your inquiry.

Yes the code you have supplied is correct. Of course you can use both the UpdateWordCount and built in property members.

If we can help with anything else, please feel free to ask.

Thanks.

Hi Adam,
Thanks for your reply.

At this point I have several issues:

1.I am using the stream option with xml and html files.html files return incorrect wordcount and the xml files can’t be processed -there is no error ,just the try doesn’t succeed:

If ext.ToString = “xml” Or ext.ToString = “XML” Then
Try
Dim lic As Aspose.Words.License = New Aspose.Words.License
lic.SetLicense(HttpContext.Current.Server.MapPath(“bin”).ToString + “\” + “Aspose.Words.lic”)
Dim stream As Stream = System.IO.File.OpenRead(file)

Dim doc As New Aspose.Words.Document(stream)
doc.UpdateWordCount()
Return (doc.BuiltInDocumentProperties.Words)
Catch ex As Exception
HttpContext.Current.Session(“Exp”) = “True”
HttpContext.Current.Response.Redirect(“default.aspx”)
End Try

2.The new Slides.dll with the license works fine with the .ppt files though the “try” doesn’t succeed when I try to upload .pptx file:

If ext = “ppt” Or ext = “PPT” Or ext = “PPTX” Or ext = “pptx” Then
Try
Dim lic As Aspose.Slides.License = New Aspose.Slides.License
lic.SetLicense(HttpContext.Current.Server.MapPath(“bin”).ToString + “\” + “Aspose.Slides.lic”)
Dim srcPres As New Presentation(file)
Dim totalWords As Integer = 0

For i As Integer = 1 To srcPres.Slides.LastSlidePosition

Dim srcSld As Slide = srcPres.GetSlideByPosition(i)

totalWords += CountWordsInShapes(srcSld.Shapes)

If Not srcSld.Notes Is Nothing Then

totalWords += CountWords(srcSld.Notes.Text)


End If
Next
Return (totalWords)
Catch ex As Exception
HttpContext.Current.Session(“Exp”) = “True”
HttpContext.Current.Response.Redirect(“default.aspx”)
End Try

3.Which option should I use with .rtf files (neither of stream or doc options didn’t work)?

Thanks a lot in advance,

Luc

Hi Luc,


Thanks for your inquiry and sorry for the delayed response.

1) Could you please attach your input documents (.xml/.html files) here for testing? I will investigate the issues on my side and provide you more information.

2) As your question is related to Aspose.Slides, I have informed Aspose.Slides team and they will answer you shortly.

3) You can simply load RTF documents into DOM by using the forllowing code:

Dim loadOptions As New LoadOptions()
loadOptions.LoadFormat = LoadFormat.Rtf

Dim doc As New Document(“C:\temp\in.rtf”, loadOptions)

Best Regards,

Hi Awais,
Thanks a lot for your reply.

I think I just tried to check it on Aspose.Words.xml and on the text of the attached file(html).

Thanks again,

Luc


Hi Hassan,
Thanks for your reply.
I receive the ‘type not defined’ error:


Erreur du serveur dans l’application ‘/translation’.

        <h2> <i>Erreur de compilation</i> </h2></span>

        <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif ">

        <b> Description : </b>Une erreur s'est produite lors de la 

compilation d’une ressource requise pour répondre à cette demande.
Veuillez consulter ci-dessous les détails relatifs à l’erreur en
question, puis modifier votre code source de manière appropriée.


        <b> Message d'erreur du compilateur: </b>BC30002: Type 'PresentationEx' non défini.<br><br>

Erreur source:








Ligne 502 :                    Dim lic As Aspose.Slides.License = New Aspose.Slides.License
Ligne 503 : lic.SetLicense(HttpContext.Current.Server.MapPath(“bin”).ToString + “\” + “Aspose.Slides.lic”)
Ligne 504 : Dim srcPres As New PresentationEx(file)
Ligne 505 : Dim totalWords As Integer = 0
Ligne 506 :
This is the code I use:

ElseIf ext = “pptx” Or ext = “PPTX” Then
Try
Dim lic As Aspose.Slides.License = New Aspose.Slides.License
lic.SetLicense(HttpContext.Current.Server.MapPath(“bin”).ToString + “\” + “Aspose.Slides.lic”)
Dim srcPres As New PresentationEx(file)
Dim totalWords As Integer = 0

For i As Integer = 1 To srcPres.Slides.LastSlidePosition

Dim srcSld As SlideEx = srcPres.GetSlideByPosition(i)

totalWords += CountWordsInShapes(srcSld.Shapes)

If Not srcSld.Notes Is Nothing Then

totalWords += CountWords(srcSld.Notes.Text)


End If
Next
Return (totalWords)
Catch ex As Exception
HttpContext.Current.Session(“Exp”) = “True”
HttpContext.Current.Response.Redirect(“default.aspx”)
End Try

Many thanks for your help,

Luc




Hi Luc,


Thanks for your inquiry. Aspose.Words.xml is a simple xml file and this file cannot be loaded by Aspose.Words. Instead, Aspose.Words supports loading XML-based formats for word processing documents e.g. WordML. For more information on this, please read the following link:
http://www.aspose.com/docs/display/wordsnet/WordprocessingML+%28DOCX%2C+XML%29

Secondly, for a correct words count, please try using the Document.UpdateWordCount method.

I hope, this will help.

Best Regards,