TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
divya
NA
186
112.1k
Regarding allignments of word document generated by ado.net
Nov 2 2012 3:01 AM
Hi
im generating word document having images (i.e barcode images) then how can i increase the space between the images(im generating barcode images in 3*3 format) programatically.
using below code generated the worddocument having images.
if (txtQuantity.Text != "0")
{
object missing = System.Reflection.Missing.Value;
object Visible = true;
object start1 = 0;
object end1 = 0;
ApplicationClass WordApp = new ApplicationClass();
Document adoc = WordApp.Documents.Add(ref missing, ref missing, ref missing, ref missing);
Range rng = adoc.Range(ref start1, ref missing);
try
{
String newpath = Path.GetFullPath("MyWord.doc");
object filename = @newpath;
adoc.SaveAs(ref filename, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing);
WordApp.Visible = true;
adoc.PageSetup.RightMargin = 200;
adoc.PageSetup.LeftMargin = 0;
WordApp.ActiveWindow.ActivePane.View.SeekView = Microsoft.Office.Interop.Word.WdSeekView.wdSeekPrimaryHeader;
int Quantity = Convert.ToInt32(txtQuantity.Text);
string path = lblPath.Text;
for (int i = 0; i < Quantity; i++)
{
rng.InlineShapes.AddPicture(@path, ref missing, ref missing, ref missing);
//rng.InlineShapes.AddPicture(@"D:\images.jpg", ref missing, ref missing, ref missing);
}
//adoc.FitToPages();
adoc.PrintPreview();
object missingvalue = Type.Missing;
object myTrue = true;
object myFalse = false;
WordApp.ActiveDocument.PrintOutOld(ref myTrue, ref myFalse, ref missingvalue, ref missingvalue, ref missingvalue, ref missingvalue, ref missingvalue, ref missingvalue, ref missingvalue, ref missingvalue, ref myFalse, ref missingvalue, ref missingvalue, ref missingvalue);
adoc.Close(ref missing, ref missing, ref missing);
WordApp.Quit(ref missingvalue, ref missingvalue, ref missingvalue);
lblPath.Text = "";
this.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message,"Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
}
}
thanks& regards
divya
Reply
Answers (
0
)
Logic to check 3 consecutive sequence
debug