Author: Ashish Gupta
Gazal by Jagjit Singh – Hai Lau Zindagi
Lyrics:-
hai lau zindagi…zindagi noor hai
magar isme jalne ka dastoor hai
adhoore se rishton me jalte raho
adhoori si sasson me pal te raho…
magar jiye jaane ka dastoor hai – 2
Hai lau zindagi..
rawayat hai ke zindagi gahana hai
ya heera hai aur chatate rahana hai
Ke lamhon main marne kaa dastoor hai-2
Hai lau zindagi..
Thanks,
Ashish
Nice add-ins for Reflector
Gios PDF .NET library
Very sleek open source PDF creation library built in .NET and its up for commercial use.
http://www.codeproject.com/KB/graphics/giospdfnetlibrary.aspx
Use sections in the config file and access them…
(
NameValueCollection)ConfigurationManager.GetSection("applicationSettings/ConnectionStrings");Visual studio 2005 Build error :- The volume for a file has been externally altered so that the opened file is no longer valid
Convert string to byte array and viceversa
string elementStringContent = System.Text.Encoding.UTF8.GetString(elementByteContent);
elementStringContent = elementStringContent.Replace(" ", "");
if (elementStringContent == string.Empty)
{
elementStringContent = "<P> </P>";
contentObject.Content = System.Text.Encoding.UTF8.GetBytes(elementStringContent);
}
Removing comments using XPathNavigator.SelectDescendants(System.Xml.XPath.XPathNodeType.Comment,false);
#region
Remove XML commentsSystem.Xml.XPath.XPathNavigator path = xmlDoc.SelectSingleNode("w:document",xmlNSMgr).CreateNavigator();
System.Xml.XPath.XPathNodeIterator commentsIterator = path.SelectDescendants(System.Xml.XPath.XPathNodeType.Comment,false);
if (commentsIterator.Count > 0)
{
while (commentsIterator.MoveNext())
{commentsIterator.Current.DeleteSelf();}}
#endregion
For the following XML:-(We needed to remove "<!– Generated by Aspose.Words for .NET 4.4.1.0 –> ")
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
– <w:document xmlns:ve="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml">
– <!– Generated by Aspose.Words for .NET 4.4.1.0
–>
– <w:body>
– <w:p>
– <w:r>
– <w:rPr>
<w:b />
<w:color w:val="FF0000" />
<w:sz w:val="24" />
</w:rPr>
<w:t>Evaluation Only. Created with Aspose.Words. Copyright 2003-2007 Aspose Pty Ltd.</w:t>
</w:r>
</w:p>
</w:body>
</w:document>
Process.Start() – Open the file from the application after writing on the file
using System.Diagnostics;
XmlDocument Xdoc = new XmlDocument();
string folderPath = @"C:\Ashish\";
string upload = folderPath + "2007.docx";
string savename = folderPath + "WordPackage.xml";
ZipPackage zipPackage = null;
byte[] packageData = null;
Stream stream;
packageData = GetBytesFromFile(upload);
stream = new MemoryStream(packageData);
if (stream != null)
zipPackage = GetZipPackageFromStream(stream);
Xdoc = RRD.DSA.SCP.OfficeAssembler.WordToXyXmlAssembler.ConvertToXyXml(zipPackage);
Xdoc.Save(savename); // Following line would open the saved file in its default application (Internet explorer)
Process.Start(strSave);
Checking for the existence of a temporary table
IF object_id('tempdb..#MyTempTable') IS NOT NULL
BEGIN
DROP TABLE #MyTempTable
PRINT 'Table dropped'
END
CREATE TABLE #MyTempTable
(
ID int IDENTITY(1,1),
SomeValue varchar(100)
)
GO