Namespace NPOI.POIFS.Crypt - c#

I installed NPOI from NuGet, version 2.1.3. I want to read encrypted excel file. By this goal according to this thread i need use class EncryptionInfo from namespace NPOI.POIFS.Crypt. But my assembly not contain this namespace.
If you look at the GitHub repository for this library, you will see this namespace in version 2.1.3.
What is my error?
P.S. Sorry for my english language

Related

Why can't I reference System.Runtime.Serialization.Json in C#

I want to use an API to get info from the interwebz. The API returns data in Json format.
I'm running Microsoft Visual Studio C# 2010 Express addition.
It appears that I have the .NET Framework 4 Client Profile set as my
"Target framework" but I'm honestly not sure exactly what this
means.
This is a Windows Forms Application...
Not much code to show because I can't really get started without the appropriate using statement...
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using System.Net;
using System.Runtime.Serialization.Json;
I get this error:
The type or namespace name 'Json' does not exist in the namespace
'System.Runtime.Serialization' (are you missing an assembly
reference?)
Am I missing a DLL file or something? Based on my hours of fruitlessly searching for solutions, I understand that the .NET 4.xx should already have the tools needed to parse up a Json formatted string?
The System.Runtime.Serialization.Json Namespace is in two different DLL's depending on your .net framework.
In .NET 3.5 It is in System.ServiceModel.Web.dll
In .NET 4.0 and above It is in System.Runtime.Serialization.dll.
Make sure you have added the correct DLL as a reference in your project and add using System.Runtime.Serialization.Json; to the top of your code file.
EDIT - Consider using JSON.NET
Even though the .NET Framework supplies its own JSON Serialization and Deserialization namespaces (DataContractJsonSerializer and JavaScriptSerializer) you should investigate whether you would be better off using JSON.NET.
JSON.NET is easier to use, better performance and has far more features.
http://www.newtonsoft.com/json/help/html/JsonNetVsDotNetSerializers.htm
you need to import System.Runtime.Serialization dll from reference
You need to add a reference to your project.
In the Solution Explorer right click references then add reference. You'll see a list of DLL's and you have to check the box next to the one you need for it to be added to the project. After you've done this you can successfully add the using statement.
Hope that helps!
The general process for serializing and deserializing JSON from C# is:
Add a reference to the System.Runtime.Serialization library.
Add using directives for System.Runtime.Serialization and System.Runtime.Serialization.Json.
Please change your Target framework from .NET Framework 4 Client Profile to .NET Framework 4
I know this is an old question, but I came across this in .NET 5.0 and the solution is to add using System.Text.Json to the top of your code.

System.IO.Compression.FileSystem.dll in c# program

I' like to use the dll System.IO.Compression.FileSystem.dll in my project
the .net framework version is 4.5 and the os is 64. The problem is that the dll is not found.
What is the solution?
The namespace is not the same as the dll name (assembly name). from the MSDN page you linked
Namespace: System.IO.Compression
Assembly: System.IO.Compression.FileSystem (in System.IO.Compression.FileSystem.dll)
So the namespace you need to include is System.IO.Compression not System.IO.Compression.FileSystem. Take off the FileSystem part from your using statement and it will solve your problem.
If people are down-voting me because the OP said "The problem is that the dll is not found." I think the OP is not using the correct word choice, if the problem really was that the DLL could not be found there would be a exclamation point by the assembly name which the original screenshot does not have
See the original image below
(click for larger view)
Compare that to my screenshot I created that would show up if the DLL really was not found, note the exclamation point I have that the original screenshot does not.
in the System.IO.Compression there's no such class as FileSystem check it out the link on the msdn
the classes available are:
DeflateStream Provides methods and properties for compressing and decompressing streams by using the Deflate algorithm.
GZipStream Provides methods and properties used to compress and decompress streams.
ZipArchive Represents a package of compressed files in the zip archive format.
ZipArchiveEntry Represents a compressed file within a zip archive.
ZipFile Provides static methods for creating, extracting, and opening zip archives.
ZipFileExtensions
if your goal is to use compression of file or stream use the GZipStream class.
However remove the FileSystem from the using statement:
using System.IO.Compression;
Anyway as Joe Enos has pointed out classes from the Compression namespace have been taken out the Client Profile from the framework 4.5
Below the Version Information from the msdn about the GZipStream:
.NET Framework
Supported in: 4.5, 4, 3.5, 3.0, 2.0
.NET Framework Client Profile
Supported in: 4, 3.5 SP1
A new nuget package is coming out. Check this out :)
https://www.nuget.org/packages/System.IO.Compression.ZipFile
Adding reference to System.IO.Compression.dll solved this issue for me.

Microsoft.Speech Reference Missing C++/cli

I'm having a hard time finding any information on this so maybe someone here can enlighten me. I've coded a module in C++/Cli, everything is good, but for some reason in the reference list(When I right-click on the VS project to add a reference), I can't find Microsoft.Speech in the list.
There is another one that's equivalent, it's called System.Speech, but I absolutely need Microsoft.Speech. Since the module is pure managed code, shouldn't I have access to all the .NET modules? Or maybe there is a pack I can download to extend it?
Thanks.
Update:
I'm referring to these two calls:
using Microsoft.Speech.AudioFormat;
using Microsoft.Speech.Recognition;
Which can be found in the Kinect SDK samples. I need those in C++/CLI because I cannot access the kinect's recognizer if I use the System native version.
Just in case you are not able to find Microsoft.Speech.dll in the .NET tab, you can do the following:
Import Microsoft.Speech.dll from the following location:
C:\Windows\assembly\GAC_MSIL\Microsoft.Speech\11.0.0.0__31bf3856ad364e35\Microsoft.Speech.dll
Here's the solution :
#using "Microsoft.Speech.dll"
using namespace Microsoft::Speech;
using namespace Microsoft::Speech::Recognition;
Everything now works perfectly.

Compiling C# code with CSC - excel interop

I am struggling with the following error when compiling my C# code with CSC - "error CS0234: The type or namespace name 'Core' does not exits in the namespace 'Microsoft.Office' (are you missing an assembly)"
I've had zero experience with object oriented programming before tackling this project. It involves automation of a couple devices through serial commands. Parameters are read from a native Excel file and data is written to Excel files that the code creates.
Here's what think maybe pertinent:
my compiling command: CSC /r:"C:\Data\Code\Microsoft.Office.Interop.Excel.dll" compiled.cs
I have the file Microsoft.Office.Interop.Excel.dll in the directory above. I found the file on my computer from something else that installed it. It is dated 2007.
I am using Office 2010
I installed Microsoft Office 2010: Primary Interop Assemblies Redistributable but can't tell what that did
I am referencing CSC from Framework (not Framework64) revision 4.0.30319
Here is the header to my code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO.Ports;
using System.Threading;
using Microsoft.Office.Core;
using Excel = Microsoft.Office.Interop.Excel;
using Microsoft.Office.Interop.Excel;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
Follow-up question (if I get this working) what things do I need to worry about to make this run on another computer? My thoughts was that all I needed was the .excel.dll and the .exe file in the same directory structure? (At this time I don't know what version of .NET or Office is being run on the target computer - my guess would be at least it would be Office 2010.)
Any guidance would be greatly appreciated. I've been wearing out google on this one for the past week+
Regards,
Keith
I know this is not the exact answer you're looking for, but I'm posting it because I think it would be more helpful than directly answering your question.
You would save yourself a LOT of time by downloading Visual C# 2010 Express and letting the IDE do the heavy lifting for you.
It sounds like you need to add a reference, which means referencing an existing .dll file somewhere. I know if can be done via the command line, but it's a LOT easier to use the IDE.
It's free, and can be found here: http://www.microsoft.com/visualstudio/en-us/products/2010-editions/visual-csharp-express
There's a How-To guide for Office Interop here: http://msdn.microsoft.com/en-us/library/dd264733.aspx

C# library using IKVM has namespace ambiguity between IKVM.OpenJDK.ClassLibrary and IKVM.OpenJDK.Core

I am using IKVM to wrap a java application into a dll. I am not particularly familiar with IKVM so I apologize in advance for not providing enough information. Anyway, I am using a c# library that makes a call to a dll created by IKVM. However the library I am using appears to require both IKVM.OpenJDK.ClassLibrary and IKVM.OpenJDK.Core. The only problem is both of these libraries contain java.util, which causes a namespace ambiguity for any class in java.util (Vectors, hastables, etc). I cannot fine a way to reference all instances of objects found in the java.utils class to explicitly use either ClassLibrary or Core. Is there anyway to reference a namespace to instruct my library to use one or the other for java.util calls?
In the current version of IKVM there is no IKVM.OpenJDK.ClassLibrary. It look like that you mix different versions of IKVM.

Categories

Resources